How to make Twitter Bootstrap menu dropdown on hover rather than click

后端 未结 30 2611
小鲜肉
小鲜肉 2020-11-22 02:08

I\'d like to have my Bootstrap menu automatically drop down on hover, rather than having to click the menu title. I\'d also like to lose the little arrows next to the menu t

30条回答
  •  情深已故
    2020-11-22 02:39

    Overwrite bootstrap.js with this script.

    jQuery(document).ready(function ($) {
    $('.navbar .dropdown').hover(function() {
        $(this).addClass('extra-nav-class').find('.dropdown-menu').first().stop(true, true).delay(250).slideDown();
    }, function() {
        var na = $(this)
        na.find('.dropdown-menu').first().stop(true, true).delay(100).slideUp('fast', function(){ na.removeClass('extra-nav-class') })
    });
    
    $('.dropdown-submenu').hover(function() {
        $(this).addClass('extra-nav-class').find('.dropdown-menu').first().stop(true, true).delay(250).slideDown();
    }, function() {
        var na = $(this)
        na.find('.dropdown-menu').first().stop(true, true).delay(100).slideUp('fast', function(){ na.removeClass('extra-nav-class') })
    });
    
    }); 
    

提交回复
热议问题