jQuery "on" with "hover" being executed on mouse out -
I have a function that is executed on the hover, but on the mouse, it runs again. Can it do this for any reason?
$ (element) .on ('hover', '.item', function () {})
The jQuery hover event is designed for information on both the start and end of the hover. When you are using it, it calls your contact handler for both mousecenter and mouseleave . You can either check the event in the Hyndor to see which event is being fired if there is a fire or you $ (element) .hover (fn1, Fn2) can switch to both function and pass both functions. > From:
Deprecated in jQuery 1.8, was deleted in 1.9: The name "Hover" is used as a cloak for string "MouseSent Mouseleave" is. It connects a single event handler to those two events, and the handler should check the event. To determine if the event is a mouse center or mouseover
, basically, you should not use the $ (Element) .on ('hover', ...); Instead, use .hover () and pass both event handlers or pass a single event handler and Event.type .
Comments
Post a Comment