单击外部后,下拉按钮消失

时间:2016-05-19 21:59:11

标签: twitter-bootstrap-3 dropdown

我在Twitter Bootstrap 3.3.6中的下拉菜单中遇到问题 点击.dropdown按钮后,我会正确显示.dropdown-menu内容,如果我再次点击.dropdown.dropdown-menu以外关闭.dropdown按钮就会隐藏

点击.dropdown后:

<ul class="nav nav-pills">
   <li role="presentation" class="dropdown open">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="true">
            Dropdown <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">...</ul>
   </li>
</ul>

Afert关闭.dropdown-menu

<ul class="nav nav-pills">
   <li role="presentation" class="dropdown" style="display: none;">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
            Dropdown <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">...</ul>
   </li>
</ul>

我该如何解决?

0 个答案:

没有答案