当我按下切换器图标时,bootstrap导航栏不显示

时间:2020-09-24 20:25:35

标签: bootstrap-4 toggle navbar angular-ui-bootstrap togglebutton

我有一个关于引导导航栏切换器的简单问题。当窗口变小时,切换器确实出现,但是当我单击它时,导航栏不会出现。想知道是否有人可以快速查看我的代码并指出可能缺少的内容。相对较新的引导程序,因此非常感谢任何帮助!

<nav class="navbar navbar-expand-lg navbar-light  ">
    <a class="navbar-brand">MY NAME HERE</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
  
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto">
        <li class="nav-item active">
          <a class="nav-link" href="/home">Home<span class="sr-only">(current)</span></a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/projects">Projects</a>
        </li> 
        <li class="nav-item">
          <a class="nav-link" href="/blogs">Blogs</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/blogs">LinkedIn</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/contact">Contact</a>
        </li>
      </ul>
    </div>
  </nav> 
nav {
    background-color: white;
    padding: 70px !important;
    width: 100%;
    position: absolute;
}

a {
    background-color: white;

}

div {
    background-color: white;
}

.navbar-brand {
    background-color: white;
    font-family: orpheuspro, serif;
    font-style: normal;
    color: black;
    font-size: 40px !important;
    font-weight: 100;
    letter-spacing: 3px;
}

.nav-link {
    background-color: white;
    float: right;
    color: black;
    font-family: orpheuspro, serif;
    font-weight: 400;
    font-style: normal;
    font-size: 23px;
    text-transform: uppercase;
}

1 个答案:

答案 0 :(得分:0)

我刚刚测试了您的代码。它工作正常。导航栏需要'collapse plugin'才能提供预期的结果。因此,请确保您引导的javascript文件已正确加载,并且该插件已包含在您使用的内部版本中。