Good evening
I've got a basic structure of ul, li and nested drop-down menus in the form of ul's. What I'm trying to do is that when the parent li is clicked, the child ul will show up. When the li is clicked again, the child ul hides.
So this is what I've got so far
$(document).ready(function() {
$("ul#glass-buttons li").toggle(function() {
$("ul", this).show();
},
function () {
$("ul", this).hide();
});
});
It works perfectly, the only problem is that there are multiple child drop-down menus. So when one is open and I click another parent li, both child ul's remain open and overlap. Can anyone recommend the best way I can hide all visible ul's when they're no longer required.
Additionally, what would be the best way to hiding any open ul when the user clicks anywhere in the document?
Thanks very much in advance. =]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…