mouseover function occurring multiple times in a queue

前端 未结 2 515
我寻月下人不归
我寻月下人不归 2021-01-25 15:03

I have this code that fades a div over another one upon mouseover, and fades out when the cursor leave the viewing area.

EXAMPLE: http://jsfiddle.net/3vgbemgu/



        
2条回答
  •  我在风中等你
    2021-01-25 15:43

    You can use .mouseenter() and .mouseleave() instead. They are triggered only once.

    $('.under').mouseenter(function() {
      $('.over').fadeIn();
    }).mouseleave(function() {
      $('.over').fadeOut();
    });
    

提交回复
热议问题