Firstly, here is the fiddle
Just a popup boot menu, I made a few changes to css so that the popup menu appears on hover (instead of a click), but as I need a very simple fading animation. I tried the css transition, but that did not work because the .dropdown-menu element has "display: none" applied to it when I hover it to change to "display: block". How can I animate an element that changes from "diplay: none" to "display: block" or is there any other way to do this?
I already looked for it and found out some answer, but they did not help.
HTML code:
<div class="dropdown"> <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown"> Dropdown <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1"> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> <li role="presentation" class="divider"></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li> </ul> </div>
CSS code:
.dropdown .dropdown-menu{ opacity: 0; transition: all 400ms ease; -moz-transition: all 400ms ease; -webkit-transition: all 400ms ease; -o-transition: all 400ms ease; -ms-transition: all 400ms ease; } .dropdown:hover .dropdown-menu { display: block; opacity: 1; }
source share