"Show Dropdown Hover & Caret Up"
Bootstrap 3.1.0 Snippet by bryanrojasq

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>Show Dropdown Hover & Caret Up</h2> <nav class="navbar navbar-default" role="navigation"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">Brand</a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li class="active"><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else here</a></li> <li class="divider"></li> <li><a href="#">Separated link</a></li> <li class="divider"></li> <li><a href="#">One more separated link</a></li> </ul> </li> </ul> <form class="navbar-form navbar-left" role="search"> <div class="form-group"> <input type="text" class="form-control" placeholder="Search"> </div> <button type="submit" class="btn btn-default">Submit</button> </form> <ul class="nav navbar-nav navbar-right"> <li><a href="#">Link</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else here</a></li> <li class="divider"></li> <li><a href="#">Separated link</a></li> </ul> </li> </ul> </div><!-- /.navbar-collapse --> </nav> </div> </div>
.caret-up { width: 0; height: 0; border-left: 4px solid rgba(0, 0, 0, 0); border-right: 4px solid rgba(0, 0, 0, 0); border-bottom: 4px solid; display: inline-block; margin-left: 2px; vertical-align: middle; }
$(function(){ $(".dropdown").hover( function() { $('.dropdown-menu', this).stop( true, true ).fadeIn("fast"); $(this).toggleClass('open'); $('b', this).toggleClass("caret caret-up"); }, function() { $('.dropdown-menu', this).stop( true, true ).fadeOut("fast"); $(this).toggleClass('open'); $('b', this).toggleClass("caret caret-up"); }); });

Related: See More


Questions / Comments:

why hover drop down is not working in responsive

Love Panchal () - 8 years ago - Reply 0


It's perfect!! tks!!!

Bruno () - 9 years ago - Reply 0


I made a proper plugin for the dropdown hover functionality, which works on every device:

mayur () - 9 years ago - Reply 0


Could you post the link here please?

maxsurguy () - 9 years ago - Reply 0


I made a proper plugin for the dropdown hover functionality, which works on every device:
https://github.com/istvan-u...

István Ujj-Mészáros () - 9 years ago - Reply 0


Great plugin! Could you please submit that to Bootsnipp Resources? http://bootsnipp.com/resources

maxsurguy () - 9 years ago - Reply 0


Thanks Maks, just submitted it.

István Ujj-Mészáros () - 9 years ago - Reply 0


Cool, approved it!

maxsurguy () - 9 years ago - Reply 0


Thx for approving the customizer too :)

István Ujj-Mészáros () - 9 years ago - Reply 0


When on lower resolution (collapsed menu), there's a continuous execution of the hover when collapsing the first menu and then steps on to the next menu. It becomes blinking. I would suggest to put .delay() between .stop() and .fadeIn()/.fadeOut().

visualjoel () - 9 years ago - Reply 0


How can I use it only for large screen and have default functioanlity for mobile screen?

Tiger In Den () - 9 years ago - Reply 0


what if i have multiple dropdown menu? how im going to align the list in every menu?

Joel () - 10 years ago - Reply 0


Yes definitely. Swap $('.dropdown-menu', this).fadeIn("fast"); and $('.dropdown-menu', this).fadeOut("fast"); with $('.dropdown-menu', this).stop( true, true ).fadeIn("fast"); and $('.dropdown-menu', this).stop( true, true ).fadeOut("fast"); to get rid of the common problem with animation queues.

Digitahlen () - 10 years ago - Reply 0


Thank you for your advice guys! Now is done what you said.

Guest () - 10 years ago - Reply 0


I would insert a .stop() before the fade effect.

Adam () - 10 years ago - Reply 0