用jQuery拖动div可以使页面被突出显示 [英] Dragging a div with jQuery causes page to be highlighted
问题描述
请参阅有关实施拖放的此前的问题。我的一切工作正常,但现在当我拖动其中一个列表项目,它也突出了几乎页面上的所有内容。有了这个以前的问题的答案,我如何做到这一点,拖曳时不突出显示任何东西?我的实际代码是3个不同的文件,与接受的答案中的示例是非常不同的(更多),所以我只会在必要时发布。
Please refer to my prior question here about implementing drag/drop. I got everything working fine, but now when I drag one of the list items, it also highlights practically everything on the page. With the answer from this prior question, how do I make it so it does not highlight anything while dragging? My actual code is 3 different files and is far different (much more) than the sample in the accepted answer, so I will post it only if necessary.
这是使用jQuery的功能通过 draggable
和 droppable
元素。这个功能是这样实现的(重命名和缩短的东西):
This is using jQuery's capabilities via draggable
and droppable
elements. This functionality is implemented like so (things renamed and shortened):
$(function () {
InitMySystem();
$("#MyList li").draggable({ revert: true });
$("#MyDropBox").droppable({
drop: function (event, ui) {
HandleDrop(selIndex, 0);
}
});
});
推荐答案
你看过 CSS user-select ?这不是标准的,但它可以帮助您解决大多数浏览器中的问题。
Have you looked at CSS user-select? It's not standard yet, but it could help you nail the issue in most browsers.
这篇关于用jQuery拖动div可以使页面被突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!