Alternative Jquery mouse event

前端 未结 1 561
小鲜肉
小鲜肉 2021-01-26 06:57

Alright so the code below works fine if I click outside the #nav div. I was asking if it is possible to just move the mouse away from the #nav div to make it disappear. I don\'t

1条回答
  •  时光说笑
    2021-01-26 07:27

    Assign a function that hides the element on the mouseleave event.

    $("#nav").mouseleave(function(){
        $(this).hide(); 
    });
    

    Fiddle: http://jsfiddle.net/howderek/SRMT8/

    0 讨论(0)
提交回复
热议问题