Avoid default drag and drop behaviour in FF3
Fierfox 3 offers the user the possibility to drag and drop images around on the pages by default. Which is nice.... I guess. But this behaviour can mix with drag and drop routines written in javascript. So how to cancel the default drag & drop in Firefox 3?
document.addEventListener("draggesture", function(event){event.stopPropagation()},true);
or if you are using jquery: $(document).bind("draggesture",function(){return false})
I haven't seen any mention of this on the net so far so I thought is was worth mentioning it.
(For IE use $(document).bind("drag",function(){return false}))
document.addEventListener("draggesture", function(event){event.stopPropagation()},true);
or if you are using jquery: $(document).bind("draggesture",function(){return false})
I haven't seen any mention of this on the net so far so I thought is was worth mentioning it.
(For IE use $(document).bind("drag",function(){return false}))
Labels: avoid, cancel, default, drag, drop, ff3, Firefox 3, javascript
3 Comments:
Thank you so much for this! You should really be #1 for "ff3 javascript drag and drop" on google... would have saved me much time and headaches!!!
thanks again!
By
Brian, At
July 22, 2008 9:47 AM
Yes, you saved me half a day at least !
Thanks !
By
Vincent San, At
October 10, 2008 3:17 AM
This post has been removed by a blog administrator.
By
Anonymous, At
November 30, 2009 9:46 AM
Post a Comment
<< Home