如何取消选择所有非输入字段的元素
我的页面上有很多大图像,当用户将光标拖动到它们上方时,蓝色选定的突出显示会遮盖图像并且不会轻易消失。我如何使用 这个插件 (noSelect jQuery-Plugin)
$.fn.noSelect = function(){
var none = 'none';
return this.bind('selectstart dragstart mousedown', function() {
return false;
}).css({
'MozUserSelect': none,
'WebkitUserSelect': none,
'userSelect': none
});
};
并找到以下元素选择和取消选择它们,除了表单、文本区域和输入字段之外,所有这些都需要选择才能发挥作用。
也许涉及 :selected
jQuery 选择器?
太感谢了!
I have alot of large images on the page and when the user drags the cursor over them the blue selected highlight overcasts the images and won't easily go away. How can I use this plugin (the noSelect jQuery-Plugin)
$.fn.noSelect = function(){
var none = 'none';
return this.bind('selectstart dragstart mousedown', function() {
return false;
}).css({
'MozUserSelect': none,
'WebkitUserSelect': none,
'userSelect': none
});
};
and find the elements which are selected and unselect them, all except forms, textareas, and input fields which need to be selected in order to function.
Maybe something involving the :selected
jQuery selector?
Thank you so much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
:selected
选择器用于 select 语句,即。列表/选项。为什么不将适当的 CSS 添加到您不想选择的图像中呢?
如果您正在侦听某些拖动事件,只需在拖动开始时将其应用于所有图像即可。
The
:selected
selector is used for select statements, ie. lists/options.Why don't you just add the appropriate CSS to the images you don't want selected?
If there is some drag event you're listening for, just apply it to all images upon drag start.