引导程序3:导航条塌陷,但没有扩展



我正在用Bootstrap 3构建一个相当简单的静态网站。

在导航方面,我需要桌面上的全宽导航栏和手机上的"汉堡"菜单。

所以我选择了Bootstrap的导航栏崩溃:

<nav class="navbar navbar-default">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="index.html"><img src="images/logo.png" alt="" /></a>
    </div>
      <!-- Collect the nav links, forms, and other content for toggling -->
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
          <ul class="nav navbar-nav navbar-right press">
              <li><a href="about.html">About</a></li>
              <li><a href="faq.html">FAQ</a></li>
              <li><a href="http://www.domain.com/blog/">Blog</a></li>
              <li><a href="index-FR.html"><img src="images/FR-flag-icon.png" alt="French Version" /></a></li>
              <li><a href="index.html"><img src="images/US-flag-icon.png" alt="English Version" /></a></li>
          </ul>
      </div>
    </div>
</nav>

正如许多其他类似问题中所建议的那样,比如这个或那个问题,我确实检查了我是否包含了最新的Bootstrap JS文件,在我的<head></head>标签之间有以下行:

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>

----------

更新:我的<head></head>:中还有以下内容

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
        <link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
        <link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all">
        <!-- web-font -->
        <link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,100,200,300,500,600,' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="css/animate.css">
        <link rel="stylesheet" href="css/jquery.wordrotator.css">       
        <!-- web-font -->
        <!-- js -->
        <script src="js/jquery.min.js"></script>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="keywords" content="email, productivity app, iphone app, clarity, peace" />

此外,在上面的代码下面,我还有一些自定义的JS脚本。

----------

更新2:以下是我的浏览器控制台日志:

http://localhost:8888/timyo/js/move-top.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8888/timyo/js/easing.js Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap.min.js:6 Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher
http://localhost:8888/timyo/images/themes.png Failed to load resource: the server responded with a status of 404 (Not Found)
base.js:1624 SVG's SMIL animations (<animate>, <set>, etc.) are deprecated and will be removed. Please use CSS animations or Web animations instead.

----------

但是,当我在浏览器中,调整窗口大小时,导航栏会变成汉堡菜单,但汉堡菜单是不可点击的,也不会展开。

知道这里出了什么问题吗?

错误为:

bootstrap.min.js:6 Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher

我只是用更新了我的部分

<script src="http://code.jquery.com/jquery-2.1.4.js"></script>

现在它运行得很好。

您还需要加载Bootstrap CSS主题,缩小或完整:

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>

请参阅此处的"入门":http://getbootstrap.com/getting-started/

相关内容

  • 没有找到相关文章

最新更新