Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a delay to submenu dropdown - bootstrap3

I can add a delay to the normal bootstrap3 dropdown menu, but in this instance I only want the delay on the submenu I've created (which isn't out the bootstrap box) - however the jquery used should still work. I need the delay so users can move the cursor to it easily without it closing (because the cursor may drift outside the a:hover element).

Take a look at this bootply - http://bootply.com/101522 and please help or advise why this isnt working!

jQuery('li.dropdown-submenu').hover(function () {
    jQuery(this).find('ul.dropdown-menu').stop(true, true).delay(200).fadeIn();
}, function () {
    jQuery(this).find('ul.dropdown-menu').stop(true, true).delay(200).fadeOut();
}); 
like image 807
Tom Rudge Avatar asked Sep 17 '26 15:09

Tom Rudge


1 Answers

You need to remove (from your CSS):

.dropdown-submenu:hover > .dropdown-menu{
    display:block;
}

This is causing it to show up instantly. I tried it in your bootply and it works perfectly.

Good Luck!

like image 70
Steve Valliere Avatar answered Sep 20 '26 05:09

Steve Valliere



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!