开发者

prevent specific sub (this) tag for event in jquery

I have this code for my menus:

$('div.content ul.menu li.expanded')
.mouseenter(function() {
    $('ul.menu li.expanded ul.menu li').slideUp(300);
    $(this).find('li.leaf').slideDown(300);
});

Third line hides all sub-menus first and then forth line shows preferred sub menus again. I've got problems using this code in different situations which is hard to explain.

All I need is, in third line: hide all sub-menus except the ones under ('this') which I have in my function.

Anyone k开发者_运维技巧nows a way to achieve this?


It's hard to be sure when we can't see the HTML in question, but this might work:

$('div.content ul.menu li.expanded').mouseenter(function() {
   $(this).find('li.leaf').slideDown(300).siblings().slideUp(300); 
}); 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜