开发者

jquery: mouseout applies to nested elements

开发者 https://www.devze.com 2023-01-19 00:39 出处:网络
ul with links nested in a div layer. mouse pointer goes over .title, ul is shown. the problem: m开发者_如何学编程ouseout() applies to nested elements

ul with links nested in a div layer. mouse pointer goes over .title, ul is shown.

the problem: m开发者_如何学编程ouseout() applies to nested elements

mouseout() is for the div

<div>
  <a class="title">Section A</a>
     <ul>
        <li><a href=''>link 1</a></li>
        <li><a href=''>link 2</a></li>
        <li><a href=''>link 3</a></li>
     </ul> 
</div>

$('.title').mouseover(function() {
   $('ul').slideDown();
})

$('div').mouseout(function(){
   $('ul').slideUp();
});


Try $('selector').mouseleave(function(){});

0

精彩评论

暂无评论...
验证码 换一张
取 消