我有两个网站。 首先,Collapsed Navbar工作:(位于http://www.doca-rbz.de(索引站点))
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">DoCa</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Startseite</a></li>
<li><a href="Kontakt.html">Kontakt</a></li>
<li><a href="Guestbook/index.php">Gästebuch</a></li>
<li><a href="ueber_uns.html">Über uns</a></li>
<li><a href="Galerie.html">Galerie</a></li>
<li><a href="lieferer.html">Partner</a></li>
<li><a href="login.php">Intern</a></li>
</ul>
</div>
</div>
</nav>
在第二页上它不起作用:(位于http://www.doca-rbz.de/new_hp(也是索引网站))
<nav class="navbar navbar-inverse" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><span> Schülercafe DoCa </span></a>
</div>
<div class="navbar-collapse collapse" id="myNavbar" aria-expanded="false">
<ul class="navbar-nav nav">
<li><a href="#">Startseite</a></li>
<li><a href="#">Kontakt</a></li>
<li><a href="#">Gästebuch</a></li>
<li><a href="#">Über uns</a></li>
<li><a href="#">Galerie</a></li>
<li><a href="#">Partenr</a></li>
</ul>
</div>
</div>
</nav>
<div class="jumbotron text-center">
<div class="container">
<h1> Willkommen auf <span class="text-gold"> SERVERNAME </span></h1>
</div>
</div>
</div>
为什么第二个不起作用?
有关代码的更多信息:
第一个代码块:
第二个代码块:
答案 0 :(得分:0)
看起来你没有正确地将“bootstrap.js”添加到第二个网站。我建议从那里开始 - 如果没有,请您在浏览器中通过控制台或开发人员工具的错误更新您的问题?
<强>更新强>
<nav class = "navbar navbar-default" role = "navigation">
<div class = "navbar-header">
<button type = "button" class = "navbar-toggle"
data-toggle = "collapse" data-target = "#example-navbar-collapse">
<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 = "#">TutorialsPoint</a>
</div>
<div class = "collapse navbar-collapse" id = "example-navbar-collapse">
<ul class = "nav navbar-nav">
<li class = "active"><a href = "#">iOS</a></li>
<li><a href = "#">SVN</a></li>
<li class = "dropdown">
<a href = "#" class = "dropdown-toggle" data-toggle = "dropdown">
Java
<b class = "caret"></b>
</a>
<ul class = "dropdown-menu">
<li><a href = "#">jmeter</a></li>
<li><a href = "#">EJB</a></li>
<li><a href = "#">Jasper Report</a></li>
<li class = "divider"></li>
<li><a href = "#">Separated link</a></li>
<li class = "divider"></li>
<li><a href = "#">One more separated link</a></li>
</ul>
</li>
</ul>
</div>
</nav>
这是应该如何设置的 - 请尝试这个,让我知道这是否适合你。