jquery – 在bootstrap下拉列表中添加延迟

前端之家收集整理的这篇文章主要介绍了jquery – 在bootstrap下拉列表中添加延迟前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图找到在这个引导程序下拉列表中添加延迟的最简单方法http://www.bootply.com/64074我尝试了各种方法和脚本,但我似乎无法做到这一点.我添加了一条css行,允许鼠标悬停时自动下拉.
<!-- Top Nav -->
                    <div class="navbar hidden-phone well well-small">
                        <div class="navbar-inner header-drop-nav">

                    <!-- 1st dropdown -->
                    <ul class="nav nav-tabs">
                        <li class="dropdown">
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">Browse by Destination <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                  <!--  1st Top Nav links -->
                            <li><a href="#">Action</a></li>
                            <li><a href="#">Another action</a></li>
                            <li><a href="#">Something else here</a></li>
                            <li class="divider"></li>
                            <li class="nav-header">Nav header</li>
                            <li><a href="#">Separated link</a></li>
                            <li><a href="#">One more separated link</a></li>
                        </ul>
                        </li>
                    </ul>

                    <!-- 2nd dropdown -->
                    <ul class="nav nav-tabs pull-middle">
                        <li class="dropdown">
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">Browse by Activity <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                  <!-- 2nd Top Nav links -->
                        <li><a href="#">Action</a></li>
                            <li><a href="#">Another action</a></li>
                            <li><a href="#">Something else here</a></li>
                            <li class="divider"></li>
                            <li class="nav-header">Nav header</li>
                            <li><a href="#">Separated link</a></li>
                            <li><a href="#">One more separated link</a></li>
                        </ul>
                        </li>
                    </ul>

                    <!-- 3rd dropdown -->
                    <ul class="nav nav-tabs">
                        <li class="dropdown">
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">Browse by Interest <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                  <!-- 3rd Top Nav links -->
                        <li><a href="#">Action</a></li>
                            <li><a href="#">Another action</a></li>
                            <li><a href="#">Something else here</a></li>
                            <li class="divider"></li>
                            <li class="nav-header">Nav header</li>
                            <li><a href="#">Separated link</a></li>
                            <li><a href="#">One more separated link</a></li>
                        </ul>
                        </li>
                    </ul>

                    <!-- 4th dropdown -->
                    <ul class="nav nav-tabs">
                        <li class="dropdown">
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">Special Offers <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                  <!-- 4th Top Nav links -->
                        <li><a href="#">Action</a></li>
                            <li><a href="#">Another action</a></li>
                            <li><a href="#">Something else here</a></li>
                            <li class="divider"></li>
                            <li class="nav-header">Nav header</li>
                            <li><a href="#">Separated link</a></li>
                            <li><a href="#">One more separated link</a></li>
                        </ul>
                        </li>
                    </ul>

                    <form class="navbar-form pull-right hidden-tablet">
                        <input class="span3" type="text" placeholder="Search">
                        <button type="submit" class="btn btn-primary">GoSeeDo</button>
                    </form>

                        </div>
                    </div>

解决方法

这个JQuery做了伎俩! http://www.bootply.com/64081
jQuery('ul.nav li.dropdown').hover(function() {
              jQuery(this).find('.dropdown-menu').stop(true,true).delay(200).fadeIn();
            },function() {
              jQuery(this).find('.dropdown-menu').stop(true,true).delay(200).fadeOut();
            });

猜你在找的jQuery相关文章