jejacks0n/mercury — Issue #98: Trying to use jQuery's Resizable - advice on extremely sluggish performance
Author: cannikin
Created: 2011-11-18 18:01:16+00:00
State: open

I suppose this is more of a support issue than a bug, but was hoping someone would have some advice for me. I want to use jQuery's [Resizable](http://jqueryui.com/demos/resizable) functionality to allow the user to resize an image after insertion onto a page (I'm aware of all the negative press on client-size image resizing, it'd be awesome if all users had access to something like Photoshop to resize the image themselves before upload, but that's not the case). The idea is that when you're done resizing I write the new width and height to the `attr()` of the image so when the page is saved the new size is saved too.

I've got the code working great but the resize is ridiculously sluggish. I can grab a handle and start resizing but nothing happens until maybe 10 seconds after I release the mouse, and the resize ends up being nowhere near where I actually released the mouse.

If I apply the same resize function to the non-editor version of the page everything runs super smooth. So, my guess is that Mercury is doing a whole bunch of processing of the source or something while I'm trying to drag the image around. Or maybe it's trying to sanitize the extra HTML that jQuery adds around the element to enable the resize in the first place? Is there maybe an event I can fire when the resize starts to tell Mercury to take a break and not worry about the contents of `.mercury-region` until I'm done resizing?