Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animating bootstrap dropdown menu on click

$('.navbar .dropdown').hover(function() {
  $(this).find('.dropdown-menu').first().stop(true, true).delay(250).slideDown();
}, function() {
  $(this).find('.dropdown-menu').first().stop(true, true).delay(100).slideUp()
});

With mouseover works fine but I need to open after clicked. If I replace .hover with .click when the dropdown is clicked it opens and close real quick.

Is it possible to do it the traditional way with bootstrap, to open when clicked and to close when mouseout or click anywhere else? Any help. Thanks.

like image 579
Labanino Avatar asked Nov 28 '22 02:11

Labanino


1 Answers

You can use CSS3 transitions:

.dropdown-menu {
    -webkit-transition: all 300ms ease-out;
    transition: all 300ms ease-out;
    opacity: 0;
    display: block;
}

.open .dropdown-menu {
    opacity: 1;
}

Check browser support on http://caniuse.com/css-transitions

like image 140
yokomizor Avatar answered Dec 11 '22 10:12

yokomizor