tags:

views:

14

answers:

1

i'm finishing writing a plugin, which allow to zoom images, and then move it, to see other parts of image. But i have a problem.

as we know, when we try to move image, (ie when we mousedown on it and move the cursor), the browser don't allow it.

i've written

$("img").mousedown(function(e)
{
   e.preventDefault();
});

and it works in Mozilla, but doesn't for example in ie.

any ideas?

Thanks much

+1  A: 

You can sort out IE by also adding e.preventDefault() to your document's mousemove event handler:

$(document).mousemove(function(e){ 
    e.preventDefault();
});
Pat
Thanks much man;) but why it only sort out IE? explain please:/
Syom
Because the other browsers are smart enough to recognize the `e.preventDefault()` in your image's mousedown handler. IE ignores that so you need the extra `e.preventDefault()` call globally on your document.
Pat
Thanks again... (P.s You have very very beautiful children:)
Syom
Hah, it's a survival mechanism for those 3am wake-ups.
Pat