Home > Web Front-end > JS Tutorial > jQuery: Solving the problem that the mouseleave event cannot be triggered when the mouse moves quickly

jQuery: Solving the problem that the mouseleave event cannot be triggered when the mouse moves quickly

黄舟
Release: 2018-05-15 11:41:55
Original
3420 people have browsed it

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();
    });
Copy after login
$("ele").stop()
Copy after login

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);
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template