Bootstrap折叠的导航栏不会对点击做出反应

时间:2020-04-07 02:01:54

标签: html bootstrap-4 responsive-design

我已经尝试了多项尝试来解决此问题的尝试,我看到的最大问题是说,加载时您会在控制台中看到一个错误,没有错误,所以我不相信那是我的问题。随着屏幕变小,我的导航栏将折叠,但是当您单击汉堡包时,什么也不会发生。

这是我的HTML

<!DOCTYPE html>
<html lang="en" class="index">

<head>
    <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" >
    <link href="https://fonts.googleapis.com/css?family=Arvo:700|Permanent+Marker" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="portfolio.css">
    <link rel="icon" type="image/png" sizes="16x16" href="./assets/favicon-16x16.png">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <title>Alice Frazier's Portfolio</title>
</head>

<body>
    <nav class="navbar navbar-expand-md navbar-dark sticky-top">
        <div class="container-fluid">
            <div class="d-none d-lg-block center">
                <p class="navbar-brand d-none d-lg-block nav-quote">"She believed she could so she did." -R.S. Grey
                </p>
                </div>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse">
            <div class="collapse navbar-collapse" id="navbarResponsive">
            <ul class="navbar-nav ml-auto">
                <li class="nav-item"><a class="nav-link" href="index.html">Home</a></li>
                <li class="nav-item"><a class="nav-link" href="#aboutmelink">About Me</a></li>
                <li class="nav-item"><a class="nav-link" href="index.resume.html">My Resume</a></li>
                <li class="nav-item"><a class="nav-link" href="index.projects.html">My Projects</a></li>
                <li class="nav-item"><a class="nav-link" href="index.resume.html.html">Contact Me</a></li>
            </ul>
        </div>
    </div>
    </nav>
    <div class="container-fluid">
    <p class="name">Alice Frazier</p>
    <p class="web">Web Design</p>
    </div>
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-6">
    <img class="mypic" src="./assets/Alice.jpg" width="500" height="600">
    </div>
        <div class="col-md-6">
    <img class="aboutmepic" src="./assets/alice2.jpg" width="350" height="450">
    </div>
    </div>
    </div>
    <div class="container-fluid">
    <p class="web" id="aboutmelink"> About Me</p>
    <p class="aboutme">Currently living and working in Indianapolis, IN. I previously worked for Dominion Dealer Solutions
        and started there as website tech support, which I loved doing, unfortunately our website team was dissolved and
        we no longer hosted websites so my next step was to support our CRM.</p>
        <br>
        <p class="aboutme">For two years I was a teacher at Sylvan Learning Center where I taught the Lego Robotics class and the Tynker Coding class.  If you would like more information on these programs check them out at the links below.</p>
        </div>
       <div class="container-fluid">
            <div class="row">
               <div class="col-md-4 home">
                  <p class="title">Sylvan Learning Center</p>
                  <a class="sylvan" href="https://www.sylvanlearning.com/" target="_blank"><img
                        src="./assets/sylvan_home_logo.png"
                        height="200" width="200"></a>
               </div>
               <div class="col-md-4 home">
                  <p class="title">Lego </p>
                  <a class="Lego"
                     href="https://www.sylvanlearning.com/stem/robotics-science"
                     target="_blank"><img
                        src="./assets/lego.jpg"
                        height="200" width="200"></a>
               </div>
               <div class="col-md-4 home">
                  <p class="title">Tynker</p>
                  <a class="Tynker" href="https://www.tynker.com/?t=reset" target="_blank"><img
                        src="./assets/tynker.png"
                        height="200" width="300"></a>
               </div>
            </div>
            </div>

    <br>
    <div class="icon">
            <a href="https://github.com/halliwell2046" target="_blank"> <i class="fa fa-github-square" style="font-size:48px"> </i></a>

            <a href="https://www.linkedin.com/in/alice-frazier-17797325/" target="_blank"> <i class="fa fa-linkedin-square" style="font-size:48px"> </i> </a>

    </div>

    <footer class="footer">
        <div class="container-fluid padding">
        <div class="row text-center">
            <div class="col-md-4">
                <p>Alice Frazier</p>
            </div> 
            <div class="col-md-4">   
                <a href="mailto:halliwell2046@yahoo.com" class="email">halliwell2046@yahoo.com</a>
            </div>
            <div class="col-md-4">
                <a href="tel+3173137712" class="phone">(317)313-7712</a>
            </div>
        </div>
        </div>
    </footer>

</body>

</html>

1 个答案:

答案 0 :(得分:0)

尝试一下。这里最主要的是导航栏。我没有改变其余的。看来您的标记顺序不正确。我已经为您解决了。

我也使用了您问题中的脚本。我没有改变他们的顺序。

运行代码段

<!DOCTYPE html>
<html lang="en" class="index">

<head>
  <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
  <link href="https://fonts.googleapis.com/css?family=Arvo:700|Permanent+Marker" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="portfolio.css">
  <link rel="icon" type="image/png" sizes="16x16" href="./assets/favicon-16x16.png">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">

  <title>Alice Frazier's Portfolio</title>
</head>

<body>
<nav class="navbar navbar-expand-md bg-dark navbar-dark">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="collapsibleNavbar">
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" href="#">Home</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">About Me</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">My Resume</a>
      </li>    
      
      <li class="nav-item">
        <a class="nav-link" href="#">My Projects</a>
      </li>    
      
      <li class="nav-item">
        <a class="nav-link" href="#">Contacts</a>
      </li>    
    </ul>
  </div>  
</nav>
  <div class="container-fluid">
    <p class="name">Alice Frazier</p>
    <p class="web">Web Design</p>
  </div>
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-6">
        <img class="mypic" src="./assets/Alice.jpg" width="500" height="600">
      </div>
      <div class="col-md-6">
        <img class="aboutmepic" src="./assets/alice2.jpg" width="350" height="450">
      </div>
    </div>
  </div>
  <div class="container-fluid">
    <p class="web" id="aboutmelink"> About Me</p>
    <p class="aboutme">Currently living and working in Indianapolis, IN. I previously worked for Dominion Dealer Solutions and started there as website tech support, which I loved doing, unfortunately our website team was dissolved and we no longer hosted websites so my
      next step was to support our CRM.</p>
    <br>
    <p class="aboutme">For two years I was a teacher at Sylvan Learning Center where I taught the Lego Robotics class and the Tynker Coding class. If you would like more information on these programs check them out at the links below.</p>
  </div>
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-4 home">
        <p class="title">Sylvan Learning Center</p>
        <a class="sylvan" href="https://www.sylvanlearning.com/" target="_blank"><img src="./assets/sylvan_home_logo.png" height="200" width="200"></a>
      </div>
      <div class="col-md-4 home">
        <p class="title">Lego </p>
        <a class="Lego" href="https://www.sylvanlearning.com/stem/robotics-science" target="_blank"><img src="./assets/lego.jpg" height="200" width="200"></a>
      </div>
      <div class="col-md-4 home">
        <p class="title">Tynker</p>
        <a class="Tynker" href="https://www.tynker.com/?t=reset" target="_blank"><img src="./assets/tynker.png" height="200" width="300"></a>
      </div>
    </div>
  </div>

  <br>
  <div class="icon">
    <a href="https://github.com/halliwell2046" target="_blank"> <i class="fa fa-github-square" style="font-size:48px"> </i></a>

    <a href="https://www.linkedin.com/in/alice-frazier-17797325/" target="_blank"> <i class="fa fa-linkedin-square" style="font-size:48px"> </i> </a>

  </div>

  <footer class="footer">
    <div class="container-fluid padding">
      <div class="row text-center">
        <div class="col-md-4">
          <p>Alice Frazier</p>
        </div>
        <div class="col-md-4">
          <a href="mailto:halliwell2046@yahoo.com" class="email">halliwell2046@yahoo.com</a>
        </div>
        <div class="col-md-4">
          <a href="tel+3173137712" class="phone">(317)313-7712</a>
        </div>
      </div>
    </div>
  </footer>

</body>

</html>