jQuery 使用 css/js 或 html 从选定图像中删除烦人的蓝色叠加层?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5225894/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Remove Annoying Blue Overlay from Selected Images with css/js or html?
提问by Code Novitiate
I'm having trouble after much googling with this, and I'm guessing maybe its not possible, but anyway I thought I should ask.
我在谷歌上搜索了很多后遇到了麻烦,我猜这可能是不可能的,但无论如何我想我应该问。
I'm making a web application with some animated clickable images and I notice (particularly in chrome but also in ff) that any slight accidental dragging over the image turns it blue. (to indicate it is selected) Is there any way in jquery, css or html to deactivate this annoying side effect, or perhaps is there a way to use images without having this default behaviour?
我正在制作一个带有一些动画可点击图像的 Web 应用程序,我注意到(特别是在 chrome 中,但在 ff 中)任何轻微的意外拖动图像都会使其变成蓝色。(表示它被选中)在 jquery、css 或 html 中是否有任何方法可以取消这种烦人的副作用,或者是否有一种方法可以在没有这种默认行为的情况下使用图像?
I hope I've made my question succinct enough. I can't provide code (commercially sensitive) but I can tell you that all my images are inside unordered lists like this:
我希望我的问题已经足够简洁了。我不能提供代码(商业敏感),但我可以告诉你,我所有的图像都在这样的无序列表中:
<ul>
<li><img src="path"/></li>
<li><img src="path"/></li>
<li><img src="path"/></li>
</ul>
回答by David says reinstate Monica
I think, to prevent user-selection cross-browser, you could use:
我认为,为了防止用户选择跨浏览器,您可以使用:
img {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}