Since the page element is a dynamically generated p, the mouseenter and mouseleave events are registered for it, so that when the mouse is moved in, a floating layer will pop up to display the details, and it will be hidden after the mouse is moved out, but when the mouse is moved quickly, When the mouse is pressed, the mouseleave event is not triggered, and the pop-up floating layer always exists. I am very confused about how to deal with it. Please give me some guidance.
The code is as follows:
$('.table').on('mouseenter','a',function(){ //ajax请求查出鼠标移入的元素对应的详情,构造一个p $(tpl).insertAfter(item); }); $('.table').on('mouseleave','a',function(){ $(this).siblings('.tips').remove(); });
$("ele").stop()
Stop all running on the specified elementanimation.
If there are animations waiting to be executed in the queue (and clearQueue is not set to true), they will be executed immediately
$(tpl).stop().insertAfter(item);
The above is the detailed content of jQuery: Solving the problem that the mouseleave event cannot be triggered when the mouse moves quickly. For more information, please follow other related articles on the PHP Chinese website!