Bootstrap 2.2.1 Tabbable选项卡不起作用

时间:2012-12-02 17:51:23

标签: twitter-bootstrap tabs

我正在使用bootstrap 2.2.1并且“tabbable tabs”选项似乎不起作用。即使我使用自己的模板(例如,带有固定顶部导航栏的简单“入门模板”)并将自己的可列表代码粘贴到我的html中,它们也不会响应。选项卡在页面中呈现正常,它们只是没有响应。该代码在较旧版本的bootstrap中为我工作 - 实际上新网站的代码几乎完全相同。非常感谢任何帮助,谢谢!

这是代码:

 <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>N.C</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="bootstrap.css" rel="stylesheet">
    <style>
      body {
        padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
      }

      .container {
        width: auto;
        max-width: 800px;
      }

      .nhc {
        font-family: lucida sans;
        font-color: white;
      }


      #footer {
        text-align: right;

        border-top-width: 1px;
        border-top-color: #990000;
      }

    </style>

    <style type="text/css">

    #footer {
      color: #c4c1ba;
    }

    </style>


    <link href="bootstrap-responsive.css" rel="stylesheet">

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Fav and touch icons -->
    <link rel="shortcut icon" href="../assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
  </head>

  <body>

    <div class="container">
        <div class="page-header">
          <div class="nhc">
          <h1>N.C</h1>
          </div>
        </div>
        <p class="lead">Pin a fixed-height footer to the bottom of the viewport in                    desktop browsers with this custom HTML and CSS.</p>
      </div>
    </div>


    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">

          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>

          <div class="nav-collapse collapse">
            <ul class="nav">
              <li><a href="#Home">Home</a></li>
              <li class="active"><a href="#About">About</a></li>
              <li><a href="#contact">Contact</a></li>
            </ul>
          </div><!--/.nav-collapse -->

          <div class="container" id="footer">
            <h4>NC</h4>
            <div id="footer">
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="container">
      <img src="mirror.jpg">
    </div>

    <div class="container">
      <div class="tabbable"> <!-- Only required for left/right tabs -->
        <ul class="nav nav-tabs">
          <li class="active"><a href="#tab1" data-toggle="tab">Section 1</a></li>
          <li><a href="#tab2" data-toggle="tab">Section 2</a></li>
        </ul>
        <div class="tab-content">
          <div class="tab-pane active" id="tab1">
            <p>I'm in Section 1.</p>
          </div>
          <div class="tab-pane" id="tab2">
            <p>Howdy, I'm in Section 2.</p>
          </div>
        </div>
      </div>
    </div>





    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="jquery-1.8.3.min.js"></script>
    <script src="bootstrap-transition.js"></script>
    <script src="bootstrap-alert.js"></script>
    <script src="bootstrap-modal.js"></script>
    <script src="bootstrap-dropdown.js"></script>
    <script src="bootstrap-scrollspy.js"></script>
    <script src="bootstrap-tab.js"></script>
    <script src="bootstrap-tooltip.js"></script>
    <script src="bootstrap-popover.js"></script>
    <script src="bootstrap-button.js"></script>
    <script src="bootstrap-collapse.js"></script>
    <script src="bootstrap-carousel.js"></script>
    <script src="bootstrap-typeahead.js"></script>
    <script src="bootstrap.js"></script>
  </body>
</html>

1 个答案:

答案 0 :(得分:1)

只需在代码中添加这两行。

<script src="bootstrap/js/bootstrap.js"></script>

<script src="bootstrap/docs/assets/js/bootstrap-tab.js"></script>