Bootstrap,奇怪的滞后

时间:2015-12-05 21:05:06

标签: html css twitter-bootstrap

我有一件很奇怪的事...... 当我点击“OPBuilder”(链接到root_path)时,“下载模板”和“当前宝石列表”不想下拉......当我再次点击时,它们是“下拉”...... 来源(bootstrap):

<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#responsive-menu">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <%= link_to 'OPBuilder', root_path, class: 'navbar-brand' %>
    </div>
    <div class="collapse navbar-collapse" id="responsive-menu">
      <ul class="nav navbar-nav">
        <li><%= link_to 'About', about_path %></li>
        <li><%= link_to 'Doc', doc_path %></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Download templates<span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="#">Teacher's template</a></li>
            <li><a href="#">About template</a></li>
            <li><a href="#">Event template</a></li>
            <li class="divider"></li>
            <li><a href="#">Download source code of project</a></li>
          </ul>
        </li>
        <li><%= link_to 'Contact', contact_path %></li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li>
          <div class="btn-group" role="group" style="padding-left: 13px; padding-right: 13px;">
             <button class="btn btn-github btn-xs navbar-btn hidden-sm"><i class="fa fa-github"></i> | Connect via GitHub</button>
             <button class="btn btn-twitter btn-xs navbar-btn hidden-sm"><i class="fa fa-twitter"></i></button>
          </div>
         </li>
         <li class="dropdown">
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><img src="/assets/gem-icon_3_1.png" role="button" aria-haspopup="true" aria-expanded="false"> Current gem list<b class="caret"></b></a>
           <ul class="dropdown-menu">
             <iframe src="assets/gem_list" seamless scrolling="auto" frameBorder="0" style="height: 100%; width: 400px;"></iframe>
           </ul>
         </li>
       </ul>
    </div>
  </div>
</nav>

(截图)

enter image description here

1 个答案:

答案 0 :(得分:0)

正常工作:(全屏运行)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>

<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#responsive-menu">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <%= link_to 'OPBuilder', root_path, class: 'navbar-brand' %>
    </div>
    <div class="collapse navbar-collapse" id="responsive-menu">
      <ul class="nav navbar-nav">
        <li><%= link_to 'About', about_path %></li>
        <li><%= link_to 'Doc', doc_path %></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Download templates<span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="#">Teacher's template</a></li>
            <li><a href="#">About template</a></li>
            <li><a href="#">Event template</a></li>
            <li class="divider"></li>
            <li><a href="#">Download source code of project</a></li>
          </ul>
        </li>
        <li><%= link_to 'Contact', contact_path %></li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li>
          <div class="btn-group" role="group" style="padding-left: 13px; padding-right: 13px;">
             <button class="btn btn-github btn-xs navbar-btn hidden-sm"><i class="fa fa-github"></i> | Connect via GitHub</button>
             <button class="btn btn-twitter btn-xs navbar-btn hidden-sm"><i class="fa fa-twitter"></i></button>
          </div>
         </li>
         <li class="dropdown">
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><img src="/assets/gem-icon_3_1.png" role="button" aria-haspopup="true" aria-expanded="false"> Current gem list<b class="caret"></b></a>
           <ul class="dropdown-menu">
             <iframe src="assets/gem_list" seamless scrolling="auto" frameBorder="0" style="height: 100%; width: 400px;"></iframe>
           </ul>
         </li>
       </ul>
    </div>
  </div>
</nav>