我是靠谱客的博主 负责大米,最近开发中收集的这篇文章主要介绍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无法触发,jQuery中trigger无法触发hover事件解决方法所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部