Tom Rudge
Tom Rudge

Reputation: 3272

jQuery dropdown delay on hover not working in bootstrap

I got the delay working using the jQuery script, but I needed to change my html so its now not the bootstrap standard dropdown, however its only a few positional changes and class changes so not sure why it's not delaying. I want the delay to be on the telephone number dropdown... http://bootply.com/67110

Javascript

$("ul.dropdown").hover(function() {
    $(this).find(".dropdown-menu").stop(true, true).delay(350).fadeIn();
}, function() {
    $(this).find(".dropdown-menu").stop(true, true).delay(200).fadeOut();
});

HTML

<ul class="pull-right dropdown inline"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><li>Call us on 0844 873 0070 <b class="caret"></b></a>
    <ul class="dropdown-menu">
        <li><a href="#">Second level link</a></li>
        <li><a href="#">Second level link</a></li>
        <li><a href="#">Second level link</a></li>
        <li><a href="#">Second level link</a></li>
        <li><a href="#">Second level link</a></li>
    </ul></li>
</ul>

Upvotes: 2

Views: 389

Answers (1)

user694844
user694844

Reputation: 1187

Your css has

ul.dropdown:hover ul.dropdown-menu { 
display: block;
}

which automatically shows the menu. You either need to remove it, or narrow its scope to cover less items.

Upvotes: 2

Related Questions