Javascript href导航栏中的div

Javascript href导航栏中的div,javascript,html,css,bootstrap-4,Javascript,Html,Css,Bootstrap 4,我正在使用一个来自引导的模板。你可以看到里面的about部分。在我的例子中,内部有一个引导按钮: 灯 按下按钮后,导航栏将通过向下滑动打开,显示“关于”部分 我已经用CSS做了所有我知道的事情,比如使用href。我认为这与引导的Javascript部分、.onclick函数或类似的东西有关 请提供帮助。对于包含导航栏about部分的div,请为其提供class=“collapse”,并提供一个id,例如id=“navbarHeader” 对于按钮add,data toggle=“collapse

我正在使用一个来自引导的模板。你可以看到里面的about部分。在我的例子中,内部有一个引导按钮:

按下按钮后,导航栏将通过向下滑动打开,显示“关于”部分

我已经用CSS做了所有我知道的事情,比如使用
href
。我认为这与引导的Javascript部分、
.onclick
函数或类似的东西有关


请提供帮助。

对于包含导航栏about部分的div,请为其提供
class=“collapse”
,并提供一个id,例如
id=“navbarHeader”

对于按钮add,
data toggle=“collapse”data target=“#navbarHeader”

确保已从引导导入javascript导入(以及样式):


请看此以供参考(您链接到的相册页面的副本)



非常感谢您。这太简单了,我花了一天的时间在谷歌上搜索它。发布你尝试过的代码。
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> 
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
    <header>
      <div class="collapse bg-dark" id="navbarHeader">
        <div class="container" style="height:200px">
          <!-- add your hidden content (expands to the height of this content-->
          <!-- if no content, then nothing to expand, i added style="height:200px", but this can be removed -->
        </div>
      </div>
      <div class="navbar navbar-dark bg-dark">
        <div class="container">
          <a href="#" class="navbar-brand d-flex align-items-center">
            <!-- your brand text/image -->
          </a>
          <!-- The menu button -->
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarHeader">
            <span class="navbar-toggler-icon"></span>
          </button>
        </div>
      </div>
    </header>