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);
});
精彩评论