我是靠谱客的博主 负责大米,这篇文章主要介绍html中hover无法触发,jQuery中trigger无法触发hover事件解决方法,现在分享给大家,希望可以做个参考。

做jquery练习的时候需要在外部触发元素的”hover”事件,于是,问题来了:根本没有触发,无论是trigger( )还是triggerHandler( ),查询后得知:

Deprecated in jQuery 1.8, removed in 1.9: The name “hover” used as a shorthand for the string “mouseenter mouseleave”. It attaches a single event handler for those two events, and the handler must examine event.type to determine whether the event is mouseenter or mouseleave. Do not confuse the “hover” pseudo-event-name with the .hover() method, which accepts one or two functions.

如果要触发”hover”事件,实际上是触发了”mouseenter”或者”mouseleave”时间,所以,

trigger("hover")`

改成:

triiger("mouseenter")

最后

以上就是负责大米最近收集整理的关于html中hover无法触发,jQuery中trigger无法触发hover事件解决方法的全部内容,更多相关html中hover无法触发内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(56)

评论列表共有 0 条评论

立即
投稿
返回
顶部