jquery - Reponsive menu using Javascript, issue -
jquery - Reponsive menu using Javascript, issue -
when click on top bar button i'd show menu doens't work...
my js code :
var topbartoggle = document.getelementbyid('top-bar-toggle'); var topbarul = document.getelementbyid('top-bar-ul'); topbartoggle.addeventlistener('click', onclickontopbartoggle, false); function onclickontopbartoggle(e){ topbarul.style.display = topbarul.style.display === 'none' ? '' : 'none'; }
my css code :
@media screen , (max-width : $container-width){ ul#top-bar-ul{ display: none; } }
when click on button, nil happens, don't have errors... <ul>
don't display:block
property...
edit #1:
var topbartoggle = document.getelementbyid('top-bar-toggle'); var topbarul = document.getelementbyid('top-bar-ul'); topbartoggle.addeventlistener('click', onclickontopbartoggle, false); function onclickontopbartoggle(e){ console.log(topbarul.style.display); topbarul.style.display = topbarul.style.display === 'none' ? 'block' : 'none'; }
logs :
main.js:101 none main.js:101 block main.js:101 none main.js:101 block main.js:101 none main.js:101
in jquery this:
$("#top-bar-toggle").on("click", function(){ $("#top-bar-ul").toggleclass("showmobile"); }); @media screen , (max-width : $container-width){ ul#top-bar-ul{ display: none; } ul#top-bar-ul.showmobile{ display: block; } }
javascript jquery css menu responsive-design
Comments
Post a Comment