When the navbar is resized, the dropdown doesn't seem to work. Is there anything wrong with my codes? Is there any solution for this?
调整导航栏的大小时,下拉列表似乎不起作用。我的代码有什么问题吗?这有什么解决方案吗?
This is my HTML code.
这是我的HTML代码。
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".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="home.php">company</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="home.php"><i class="glyphicon glyphicon-home"></i><span> Home</span></a></li>
<li><a href="order.php"><i class="glyphicon glyphicon-pencil"></i><span> Order</span></a></li>
<li><a href="cart.php"><i class="glyphicon glyphicon-shopping-cart"></i><span> Cart</span></a></li>
<li><a href="contactus.php"><i class="glyphicon glyphicon-earphone"></i><span> Contact Us</span></a></li>
<li><a href="about.php"><i class="glyphicon glyphicon-search"></i><span> About Us</span></a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="register.php"><i class="glyphicon glyphicon-registration-mark"></i><span> Register</span></a></li>
<li class="active"><a href="login.php"><i class="glyphicon glyphicon-user"></i><span> Login</span></a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
This is the demo. http://jsfiddle.net/5TATB/
这是演示。 http://jsfiddle.net/5TATB/
Thanks in advance!
提前致谢!
1 个解决方案
#1
1
According to what I had saw in the console, you did not include jquery framework on jsfiddle
and I am sure you did it exactly in your code.
根据我在控制台中看到的内容,你没有在jsfiddle上包含jquery框架,我相信你在代码中完全做到了。
Bootstrap was built with a jquery
complement. Before you can use the bootstrap nice javascript plugins you must include jquery
before bootstrap.min.js
.
Bootstrap是用jquery补充构建的。在使用bootstrap nice javascript插件之前,必须在bootstrap.min.js之前包含jquery。
请参阅此处的文档
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
在这里工作演示
#1
1
According to what I had saw in the console, you did not include jquery framework on jsfiddle
and I am sure you did it exactly in your code.
根据我在控制台中看到的内容,你没有在jsfiddle上包含jquery框架,我相信你在代码中完全做到了。
Bootstrap was built with a jquery
complement. Before you can use the bootstrap nice javascript plugins you must include jquery
before bootstrap.min.js
.
Bootstrap是用jquery补充构建的。在使用bootstrap nice javascript插件之前,必须在bootstrap.min.js之前包含jquery。
请参阅此处的文档
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
在这里工作演示