Dropdown menu
-
Hello.
In the wpadverts plugin on the categories page I wanted to make a drop-down menu in javascript, put the classes, but the code didn’t work. Maybe I put the classes wrong or the code was written with errors? I found the code on the Internet. Can you help me?Classes used such !
adverts-categories-all
adverts-flexbox-wrap
adverts-flexbox-listdocument.getElementById('adverts-categories-all').onclick = function(event) { var target = event.target; if (target.className == 'adverts-flexbox-wrap') { var s = target.getElementsByClassName('adverts-flexbox-list'); closeMenu(); s[0].style.display='block'; } } document.onclick=function(event) { var target = event.target; console.log(event.target); if (target.className!='adverts-flexbox-wrap' && target.className!='adverts-flexbox-list'){ closeMenu(); } } function closeMenu() { var menu = document.getElementById('adverts-categories-all'); var subm=document.getElementsByClassName('adverts-flexbox-list'); for (var i=0; i <subm.length; i++) { subm[i].style.display="none"; } }
Thanks you !
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘Dropdown menu’ is closed to new replies.