Bootstrap4 NavBar for Mobile错误

时间:2018-11-30 21:40:17

标签: html mobile bootstrap-4 navbar

我要使用Bootstrap为网站编码。在那里,我的导航栏非常适合台式机。但是,当我将本网站用于移动设备时,带有所有链接的按钮不起作用。 a pic for more accurate description

这是我的html代码:

<nav class="navbar navbar-toggleable-md navbar-inverse bg-inverse bg-faded py-md-3">
  <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand nav-link display-5" href="#">Pomics</a>
  <div class="collapse navbar-collapse" id="navbarSuportedContent">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link display-5" href="index.html">Startseite<span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Diskussionen</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Umfragen</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Quellensammlung</a>
      </li>
    </ul>
    <form class="form-inline my-2 my-lg-0">
      <button class="btn btn-outline-success my-2 my-sm-0">Anmelden</button>
    </form>
  </div>
</nav>

某人可以帮助我解决我的问题吗? 先感谢您! lg bttl

1 个答案:

答案 0 :(得分:1)

确保您为切换器设置了正确的目标名称...

当前您拥有:var geoposition = { lat: window.pos.lat, lng: window.pos.lng }; geoposition.__proto__.toString = function(){ return "lat: "+this.lat+", lng: "+this.lng } console.log("Searching nearby donations to: "+geoposition.toString()); ,但是data-target="#navbarNav"中没有元素,因此单击按钮时什么也不会发生。

id="navbarNav"更改为id="navbarSuportedContent"