javascript – Bootstrap Responsive Nav Bar

前端之家收集整理的这篇文章主要介绍了javascript – Bootstrap Responsive Nav Bar前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我可能错过了一些非常小的东西,这令我感到沮丧,因为我现在坐在这里几个小时试图解决这个问题. Navbar不会与 Javascript链接.正确调整窗口大小时会出现按钮,但单击时不会折叠菜单.

快速浏览我的Header中的链接(以防它们的顺序错误)

  1. <link rel="stylesheet" href="/assets/css/bootstrap.css">
  2. <link rel="stylesheet" href="/assets/css/bootstrap-responsive.css">
  3. <link rel="stylesheet" href="/assets/css/style.css?v=2">
  4.  
  5. <script src="/assets/js/bootstrap.js"></script>
  6. <script src="/assets/js/bootstrap.min.js"></script>
  7. <!-BootStrap--><script src="/assets/js/jquery-1.7.1.min.js"></script>
  8. <script src="/assets/js/jquery.validate.min.js"></script>
  9. <script src="/assets/js/script.js"></script>
  10. <script src="/assets/js/bootstrap-fileupload.js"></script>

快速查看我的HTML –

  1. <div class="navbar navbar-fixed-top">
  2. <div class="navbar-inner">
  3. <div class="container">
  4. <!--<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">-->
  5. <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
  6. <span class="icon-bar"></span>
  7. <span class="icon-bar"></span>
  8. <span class="icon-bar"></span>
  9. </a>
  10. <div class="span4">
  11. <a href="{site_url}" title="People Team">
  12. <img src="/assets/img/logo.png" alt="People Team logo" />
  13. </a>
  14. </div>
  15. <nav>
  16. <div class="nav-collapse">
  17. <ul class="nav">
  18. <li{if segment_1 == ""} class="active"{/if}>
  19. <a href="/" title="Home">Home</a>
  20. </li>
  21. <li{if segment_1 == "services"} {/if}>
  22. <a href="/services" title="Contact People Team">Services</a>
  23. </li>
  24. <li{if segment_1 == "about"} {/if}>
  25. <a href="/about" title="About People Team">About the team</a>
  26. </li>
  27. <li{if segment_1 == "contact"} {/if}>
  28. <a href="/contact" title="Contact People Team">Contact Us</a>
  29. </li>
  30. </ul>
  31. </div>

我假设Javascript位于Bootstrap.min.js或Bootstrap.js文件中,这些文件是导航栏工作所必需的.我只是难过.任何帮助,将不胜感激.

干杯,

解决方法

更改JS加载的顺序.首先是jQuery,然后是bootstrap插件.
  1. <script src="/assets/js/jquery-1.7.1.min.js"></script>
  2. <script src="/assets/js/bootstrap.js"></script> -- remove,as it is not really needed when including the minified version
  3. <script src="/assets/js/bootstrap.min.js"></script>

猜你在找的JavaScript相关文章