开发者

Jquery menu, select just the next child depth

开发者 https://www.devze.com 2023-04-12 02:22 出处:网络
example here http://www.brvr.net/menu Hello, finishing my menu, but with one problem. On mouse over / leaveit works good, but on hover the 3rd level (nivel_3) is showed when hovering 1st level (nov

example here http://www.brvr.net/menu

Hello,

finishing my menu, but with one problem.

On mouse over / leave it works good, but on hover the 3rd level (nivel_3) is showed when hovering 1st level (novel_1), with should just show the 2nd level (nivel_2)

how can I s开发者_StackOverflow中文版olve this

$('.nivel_'+nivel+'').hover(
        function() { $(this).find('ul > li').css('display', 'block'); },
        function() { $(this).find('li').css('display', 'none'); }
    );

Thanks


Without knowing your HTML it's hard to be exact, but I expect you only want the ul that are direct children of the element being hovered.

$('.nivel_'+nivel+'').hover( 
    function() { $(this).find('> ul > li').css('display', 'block'); }, 
    function() { $(this).find('li').css('display', 'none'); } 
);
0

精彩评论

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

关注公众号