Disable Firefox Image Drag
来源:互联网 发布:国产高仿手办淘宝店铺 编辑:程序博客网 时间:2024/05/29 08:32
Firefox 3 has a behavior where clicking an image and moving your mouse will start to drag a preview of that image around. The behavior even occurs with the background images for elements.
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...
}
- Disable Firefox Image Drag
- Raphel image drag 拖动
- Disable select in Mozilla Firefox
- How to disable firefox cache
- FireFox不支持disable-output-escaping解决办法
- Drag-and-Drop Image Vector——拖拽Image Vector
- drag
- 搬砖,android drag and drop button or image
- Disable Adobe Flash Player Plugin in Firefox 2.0
- firefox的background-image引发的页面请求问题
- as2 flash firefox session image 上传图片 丢失问题
- Image corrupt or truncated: <unknown>, Firefox 4
- Drag Layer
- javascript drag
- javascript drag
- SVG drag
- Drag &Drop
- Drag & Drop
- struts2属性文件
- 男女朋友的关系就是这样确立的......
- 各科电子书下载
- Linux 本地root密码破解
- OpenGL实现3d
- Disable Firefox Image Drag
- Windows中的待机,休眠,睡眠的区别!
- Android Bitmap和Canvas
- 从 Google 代码库找到的好东西
- bitloading时间处理
- C++类的静态成员函数在多线程的工作机制以及运行过程中强制结束线程实验
- 最近的思考!
- 【20100209】onblur 和onfocus问题
- C++子结构间接自杀实验