Jquery mouseover and mouseout keeps flashing

后端 未结 3 886
-上瘾入骨i
-上瘾入骨i 2021-01-13 11:28

I am having some issues with jQuery MouseOut and MouseOver.

Every time I hover over the selected div, the child div that needs to show appears. however, it starts fl

相关标签:
3条回答
  • 2021-01-13 12:01

    In jQuery, both mouseover() and mouseenter() events are fire when the mouse enters the matched element. The only different is in the way of the “event bubbling” handle in child element Ref:http://www.mkyong.com/jquery/different-between-mouseover-and-mouseenter-in-jquery/

    Please find the answer in jsfiddle.. http://jsfiddle.net/Dn6Rq/1/

    $(document).ready(function () {
    
        $('.section-text').hide();
    
        $('.section-item-portal').mouseenter(function () {
            $(this).children('.section-text').fadeIn();
        });
    
        $('.section-item-portal').mouseleave(function () {
            $(this).children('.section-text').fadeOut();
        });
    
    });
    
    0 讨论(0)
  • 2021-01-13 12:06

    DEMO

    Use mouseenter and mouseleave instead.

    $(document).ready(function () {
    
        $('.section-text').hide();
    
        $('.section-item-portal').mouseenter(function () {
            $(this).children('.section-text').fadeIn();
        });
    
        $('.section-item-portal').mouseleave(function () {
            $(this).children('.section-text').fadeOut();
        });
    
    });
    
    0 讨论(0)
  • 2021-01-13 12:14

    try this

    $(document).ready(function() {
        $('.section-text').hide();
    
        $('.section-item-portal').hover(function() {
            $(this).children('.section-text').fadeIn();
        },function(){
            $(this).children('.section-text').fadeOut();
        });
    
    });
    
    0 讨论(0)
提交回复
热议问题