While this drag and drop behavior for images in Firefox can be really usefull for the visitor, this behavior can be a real problem if you're writing an application that depends on JS to drag around elements that contain images or have background images.
Placing the image or element inside a container and attaching event listeners to that container instead of the image or element with a background seems like an obvious answer, but it will only work for the first click. If the visitor drops the element and tries to drag it again Firefox will start up with the drag and drop behavior.
What does work though is having your
mousedown
event listener prevent the default action, which seems to be that drag and drop behavior.Within the event handler you're assigning to your
mousedown
event, assuming you're argument list includes an event object, as is the case with most jQuery event handlers, your function declaration might look like this.var callback = function(event){
if(event.preventDefault)
{
event.preventDefault();
}
// Other code...
}
Nice and easy.