本文介绍了.is(":hover") 自 jQuery 1.9 起已损坏 如何修复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
When doing $(...your selector here...).is(":hover")
, jQuery prior to 1.9.1 gave correct answer, while jQuery 1.9.1 tells you this:
This is not about performing an action on hover - for that, just use .hover()This is about, at an arbitrary point in time, finding out whether or not some element is being hovered
Thank you Mooseman for the answer, which I shall demonstrate with a fiddle
解决方案
Assuming your selector is #myid
, use $('#myid:hover')
instead of using .is()
.
If you are using $(this)
or a variable, use myVar.filter(':hover')
.
这篇关于.is(":hover") 自 jQuery 1.9 起已损坏 如何修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!