![悬停事件将被阻止 悬停事件将被阻止]()
本文介绍了当select2下拉列表打开时,悬停事件将被阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当Select2下拉列表打开时,JavaScript悬停事件和css伪类不再起作用。
Eg
p:hover {
color:red
}
只有在关闭下拉菜单时才有效,并且不会在打开时显示。
请参阅此处以获取自包含的示例:
这可能与 https:/ / b
$ b 我期待着任何反馈!
解决方案
.select2-results .select2-highlight {
color:red;
}
When a Select2 dropdown is open, the JavaScript hover event and the css pseudoclass do not work anymore.E.g.
p:hover {
color: red
}
only has effect when the dropdown is closed and not when it's opened.
See here for self contained example: http://jsfiddle.net/cre5hckw/6/
This may be related to https://github.com/ivaynberg/select2/issues/1715.
I'm looking forward to any feedback!
解决方案
Select2 uses a class, not :hover pseudoclass.
.select2-results .select2-highlighted {
color: red;
}
这篇关于当select2下拉列表打开时,悬停事件将被阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!