I’m reworking a WHMCS menu to be responsive and touch sensitive. Everything is fine except for one thing. I can’t get the proper elements to display/toggle properly.
What the jQuery script does is add “open” class to parent element onclick. So
<div id="menu-icon"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Menu</a></div>
Becomes:
<div id="menu-icon" class="open"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Menu</a></div>
When the “Menu” link is clicked.
I need the “#nav” to “display:none” by default, and “display:block” when Menu is clicked. I can’t quite capture it via CSS.
My HTML
<nav id="nav-wrap">
<div id="menu-icon"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Menu</a></div>
<ul id="nav">
My CSS
#nav-wrap #nav {
display: none;
}
#nav-wrap #menu-icon.open #nav {
display: block;
}
With the code above, I can hide the #nav by default, but that’s it. Any pointers on how to capture #nav?
Boss, there is fundamental mistake you have done.
You have given this code:
See, the
#navdoesn’t come under#menu-icon. Change the code to:And it works!
Demo here: http://jsfiddle.net/qqbUY/
Screenshot