LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

CSS
.clear { clear:both }
#hover .dropdown:hover > ul.dropdown-menu,
#click .dropdown-toggle:focus + ul.dropdown-menu{
  display:block;
}
JS
var linkys = document.getElementsByClassName('dropdown-toggle');
for (var i = 0; i < linkys.length; ++i) {
  linkys[i].onclick = function(e) {
    //if this isn't an http/https link
    this.focus(); 
    e.preventDefault();
  };
}

// for old browsers you might need a polyfill https://www.google.co.uk/search?q=getElementsByClassName+polyfill
Host Instantly Drag and Drop Website Builder

 

Description

probably the most minimal dropdown navs in the world. no library. pure js (3 lines) and css (one line). hover or onclick. uses bootstrap for convenience in this example code :)
Term
Mon, 11/27/2017 - 21:59

Related Codes

Pen ID
Pen ID
Pen ID