.is(":hover") 自 jQuery 1.9 起已损坏 如何修复 [英] .is(":hover") is broken as of jQuery 1.9 How to fix

查看:13
本文介绍了.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:

Error: Syntax error, unrecognized expression: unsupported pseudo: hover

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 起已损坏 如何修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆