javascript - How do i make a <nav> toggle from underneath a div? -
i nav (inside header) attached bottom of div .menu_bar when nav toggled slide down directly underneath. nav not inside div , div isn't inside nav, separate in html. can't nav slide down div , when works screen size , breaks again when change width of screen.
<header> <nav> <ul> <li><a href="#">home</a></li> <li class="submenu" > <a href="#">nielsen products<span class="icon-arrow-down2"></span><span class="caret"></span></a> <ul class="children"> <li><a href="#">exterior cleaning<span class="icon-dot-single"></span></a></li> <li><a href="#">interior cleaning<span class="icon-dot-single"></span></a></li> <li><a href="#">odour control & air fresheners<span class="icon-dot-single"></span></a></li> <li><a href="#">exterior finishes<span class="icon-dot-single"></span></a></li> <li><a href="#">dressings<span class="icon-dot-single"></span></a></li> <li><a href="#">glass cleaning<span class="icon-dot-single"></span></a></li> <li><a href="#">workshop maintenance<span class="icon-dot-single"></span></a></li> <li><a href="#">janitorial<span class="icon-dot-single"></span></a></li> <li><a href="#">tds & sds info<span class="icon-dot-single"></span></a></li> </ul> </li> <li><a href="#">nielsen catalogue</a></li> <li class="submenu1"> <a href="#">equipment/tools/consumables<span class="icon-arrow-down2"></span><span class="caret"></span></a> <ul class="children1"> <li><a href="#">valeting, brushes , equipment<span class="icon-dot-single"></span></a></li> <li><a href="#">tools & equipment<span class="icon-dot-single"></span></a></li> <li><a href="#">workshop consumables<span class="icon-dot-single"></span></a></li> <li><a href="#">adblue<span class="icon-dot-single"></span></a></li> </ul> </li> <li><a href="#">contact us</a></li> <li><a href="#">about us</a></li> <li><a href="#">photo gallery</a></li> </ul> </nav> </header> <div class="menu_bar"> <a href="#" class="bt-menu"><span class="icon-menu"></span>menu</a> </div>
by way div @ bottom isn't inside apart body tags ( don't know if shows clearer enough)
.bt-menu { position: relative; top: 50%; -webkit-transform: translatey(-50%); -ms-transform: translatey(-50%); transform: translatey(-50%); } .menu_bar { display: block; width: 100%; height: 10%; padding-top: 35px; position: relative; background: #ff0000; z-index: 999; font-size: 15px; margin: 0; } .menu_bar .bt-menu { display: block; color: #fff; padding-left: 25px; padding-right: 25px; overflow: hidden; font-size: 25px; font-weight: bold; text-decoration: none; } .menu_bar span { float: right; font-size: 20px; } header nav { width: 80%; height: 100%; top: 0; position: fixed; margin: 0; overflow-y: scroll; z-index:9999; }
just changes , according fiddle
header nav { width: 80%; height: 100%; top: 0; margin: 0; overflow-y: hidden; z-index:9999; }
check fiddle -> http://jsfiddle.net/1hpo3w46/3/
Comments
Post a Comment