单击

时间:2017-10-02 20:47:27

标签: html css twitter-bootstrap

菜单下拉一小段时间后再返回。任何人都可以帮忙解决它吗?如果有人可以建议我使用代码来使其工作,那就更好了。

这是代码:

<nav class="navbar transparent navbar-inverse navbar-fixed-top">
  <div class="navbar-inner">
    <div class="container">
      <a class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target="#main_nav">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>
      <a class="brand" href="index.html"> <strong>RESOLUTION ACCOUNTING</strong> </a>

      <div id="main_nav" class="collapse nav-collapse">
        <ul class="nav pull-right ">
          <li><a href="index.html" class="active">HOME</a></li>
          <li><a href="aboutus-resolution-accounting-west-chester.html">ABOUT US</a></li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"> SERVICES <b class="caret"></b> </a>
            <ul class="dropdown-menu">
              <li><a href="index.html">Bookkeeping</a></li>
              <li><a href="accounting-services-west-chester-resolution-accounting.html">Accounting</a></li>
              <li><a href="cfo-oversight-services-west-chester-resolution-accounting.html">CFO Oversight</a></li>
              <li><a href="equity-raises-west-chester-resolution-accounting.html">Equity Raises</a></li>
            </ul>
          </li>
          <li><a href="testimonials-resolution-accounting.html">TESTIMONIALS</a></li>
          <li><a href="contact.html">CONTACT US</a></li>
        </ul>
        </div>
      </div>
    </div>
  </div>
</nav>

2 个答案:

答案 0 :(得分:0)

您正在使用Bootstrap版本2.3.2 CSS和Bootstrap版本3.3.6 Javascript。它们彼此不兼容。您需要为CSS和Javascript使用相同版本的Bootstrap才能获得正确的行为。

(如果您已将网址包含在http://website.com中,那将会很有帮助。)

答案 1 :(得分:0)

您可以使用解决方案https://jsfiddle.net/wqy986bt/

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<nav class="navbar transparent navbar-inverse navbar-fixed-top">
  <div class="navbar-inner">
    <div class="container">
      <a class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target="#main_nav">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>
      <a class="brand" href="index.html"> <strong>RESOLUTION ACCOUNTING</strong> </a>

      <div id="main_nav" class="collapse nav-collapse">
        <ul class="nav pull-right ">
          <li><a href="index.html" class="active">HOME</a></li>
          <li><a href="aboutus-resolution-accounting-west-chester.html">ABOUT US</a></li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"> SERVICES <b class="caret"></b> </a>
            <ul class="dropdown-menu">
              <li><a href="index.html">Bookkeeping</a></li>
              <li><a href="accounting-services-west-chester-resolution-accounting.html">Accounting</a></li>
              <li><a href="cfo-oversight-services-west-chester-resolution-accounting.html">CFO Oversight</a></li>
              <li><a href="equity-raises-west-chester-resolution-accounting.html">Equity Raises</a></li>
            </ul>
          </li>
          <li><a href="testimonials-resolution-accounting.html">TESTIMONIALS</a></li>
          <li><a href="contact.html">CONTACT US</a></li>
        </ul>
      </div>
    </div>
  </div>
</nav>

有几件事:

  • 您的代码末尾有一个额外的结束div
  • 检查库文件的顺序
    • bootstrap CSS
    • 的jQuery
    • bootstrap JS

我使用了bootstrap v3.3.7jQuery v2.1.1in snippet)和jQuery v2.2.4in jsfiddle

希望这会对你有所帮助。