停止Chrome的点击并按住/拖动图片默认行为 [英] stop Chrome's click and hold / drag image default behavior

查看:1368
本文介绍了停止Chrome的点击并按住/拖动图片默认行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,在Google Chrome浏览器中,您可以点击并按住图片,同时按住图片的半透明副本使用光标。

I've noticed that in Google Chrome, one can click and hold an image and while holding a semi-transparent copy of that image attaches itself with the cursor. Then one can drag that image to the desktop to save it.

我想防止和停止图像的半透明版本附加到游标的保持

I want to prevent and stop the semi-transparent version of the image attaching itself to the cursor on hold of certain images in my site.

推荐答案

p>您可以使用属性

-webkit-user-drag: auto | element | none;

请参阅的文档-webkit-user-drag CSS-infos.net (我找不到MDN文档,如果有人有更好的参考)

See the doc of -webkit-user-drag CSS-infos.net (I didn't find an MDN doc, if someone has a better reference)

img 标签上添加code> .nonDraggableImage 类,并在CSS上添加:

Add a .nonDraggableImage class on your img tags, and add on your CSS :

.nonDraggableImage{
    -webkit-user-drag: none;
}

这篇关于停止Chrome的点击并按住/拖动图片默认行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆