我正在使用bootstrap创建一个响应式网站&当屏幕尺寸很小时我的导航栏切换按钮出现问题...
当我所有的.php文件都在同一目录(根目录)时,按钮工作正常;但是我只是更改了它,以便所有.php文件现在都在各自的文件夹中(contact.php现在是contact / index.php等)来创建更清晰的URL。这导致切换按钮在单击时不再切换。
我的导航代码如下;非常感谢任何见解,谢谢!
<!-- NAVIGATION -->
<div class="navbar navbar-default" role="navigation">
<div class="navbar-inner">
<div class="container inner-container">
<div class="navbar-header">
<a href="index.php" class="navbar-brand"><img src="../img/index/skytek-logo/Skytek_c1_S.png" width="160px" height="90px" alt="Skytek Logo"></a><p class="navbar-slogan">Dedicated to excellence in innovation and service</p>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#nav-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="nav-collapse">
<ul class="nav navbar-nav">
<?php
/* list items with a class of "active" indicate the current section;
* the $section variable is set in each individual file
*/
?>
<li class="home <?php if ($section == "home") { echo "active"; } ?>"><a href="<?php echo BASE_URL; ?>">Home</a></li>
<li class="about <?php if ($section == "about") { echo "active"; } ?>"><a href="<?php echo BASE_URL; ?>about/">About Us</a></li>
<li class="support <?php if ($section == "support") { echo "active"; } ?>"><a href="<?php echo BASE_URL; ?>services/">Support & Services</a></li>
<li class="sales <?php if ($section == "sales") { echo "active"; } ?>"><a href="#" style="color: #AAA;">Sales</a></li>
<li class="news <?php if ($section == "news") { echo "active"; } ?>"><a href="#" style="color: #AAA;">News</a></li>
<li class="contact <?php if ($section == "contact") { echo "active"; } ?>"><a href="<?php echo BASE_URL; ?>contact/">Contact</a></li>
<li class="careers <?php if ($section == "careers") { echo "active"; } ?>"><a href="<?php echo BASE_URL; ?>careers/">Careers</a></li>
<li class="staff <?php if ($section == "staff") { echo "active"; } ?>"><a href="<?php echo BASE_URL; ?>staff/">Staff Zone</a></li>
</ul>
</div>
</div>
</div>
</div>
<!-- END NAVIGATION -->
答案 0 :(得分:0)
谢谢ckuijjer;我将js文件的路径从'js / bootstrap.min.js'更改为'../js/bootstrap.min.js',切换按钮现在完美运行..