0

Can anyone share any javascript code for responsive drop-down menu ?

please share only javascript if you have no jquery

13th Jul 2018, 12:59 PM
Nayem
3 ответов
+ 1
You could try something like this to open and close it, but it won't be animated. // give the button and menu elements IDs var menu = document.getElementById("menu"); function toggleMenu(){ if (menu.style.display == "none"){ menu.style.display = "block"; } else{ menu.style.display = "none"; } } var button = document.getElementById("button"); button.addEventListener("click", toggleMenu); The CSS is the tricky part, though. You want it positioned nicely. Try using absolute positioning and putting the menu in a div with the open/close button. This is only a very basic menu, sorry.
13th Jul 2018, 1:44 PM
James
James - avatar
13th Jul 2018, 3:24 PM
Calviղ
Calviղ - avatar
0
thanks
13th Jul 2018, 1:48 PM
Nayem