开发者

disable default behavior of image when try to move in in browser

开发者 https://www.devze.com 2023-01-13 22:04 出处:网络
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.

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


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

$(document).mousemove(function(e){ 
    e.preventDefault();
});
0

精彩评论

暂无评论...
验证码 换一张
取 消