.is(" hover")在jQuery 1.9中被破解如何解决 [英] .is(":hover") is broken as of jQuery 1.9 How to fix
问题描述
$(...你的选择器在这里)is。(:hover)
,1.9.1之前的jQuery给出了正确的答案,while jQuery 1.9.1告诉你:$ b
错误:语法错误,无法识别的表达式:不支持伪:
hover code>
这是一种解决方法(不需要回答。)
http://jsfiddle.net/mathheadinclouds/V342R/
简短回答,检查是否存在
.parent()。find(:hover)
的长度为1,并且包含有问题的元素。
这不是关于在悬停上执行动作 - 为此,只需使用.hover()
这是关于在任意时间点查找某个元素是否被徘徊
#myid
,请使用 $( '#myid:hover')
而不是使用 .is()
。 如果您正在使用 $(this)
或变量,请使用 myVar.filter(':hover')
。
When doing $(...your selector here...).is(":hover")
, jQuery prior to 1.9.1 gave correct answer, while jQuery 1.9.1 tells you this:
Error: Syntax error, unrecognized expression: unsupported pseudo:
hover
Here is a workaround (answering not necessary.)
http://jsfiddle.net/mathheadinclouds/V342R/
short answer, check whether
.parent().find(":hover")
has length 1, and contains the element in question.
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
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中被破解如何解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!