The hover event is a common problem we encountered in the early stages of development, but there is no discovery that there will be a bug, for example, you move to an element, let it execute a method, and then you quickly move out of the time, he will be bright blind your eyes strobe effect, And it's going to be like Alzheimer's. Delayed display, 24K titanium alloy will also be blind, the mouse repeatedly in the corresponding area of the slide, the animation will continue to execute, until and the number of times the mouse passed the same position. For example, the mouse moves 3 times, moves out 3 times, the animation will appear three times. This obviously has a profound impact on the user experience. Then our company large back-end told me that the MouseEvent and Monseleave merged into a hover event, but also the meaning of the words to tell me that this is the problem (the big front end unexpectedly by the back end of the education, excessive), but I do not have any eggs after the merger (PA Face), I remember this is the hover of the different wording. OK, no chatter, start talking about your solution:
At first I thought of event bubbling or event capture, because I use the DOM structure is Li inside the package UL, so think of event capture, then to stop the event capture it,
E.stoppropagation ()
Still flashing, and not resolved. So that's not the reason, so stop it from the source.
Method One: Delay error operation plug-in-hoverintent
: http://www.jq22.com/jquery-info274
This plugin can be a good solution to this bug, prevent misoperation, compatible with various browsers, including disgusting IE6, conscience recommended
Method Two: The Stop method of JQ
Put a stop () in front of your animation, I need to write Slideup (), so I should write
$ ("Dom"). Stop (False,false). Fadeup ()
Perfect solution!!!
JS in the hover event when the bug and solution