Bootstrap导航菜单中的链接未打开。当你点击它什么都没有打开。
单击购物车超链接时,购物车文件无法打开。我仔细检查了路径,这是正确的。
主文件:
<nav class="navbar navbar-default">
<div class="container-fluid">
<ul class="nav navbar-nav navbar-right pull-right">
<li>
<a href="Cart/Cart.aspx" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="glyphicon glyphicon-shopping-cart"></span><asp:Label ID="CartCountL" runat="server" CssClass="badge badge-warning" text="2"/>
</a>
</li>
</ul>
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<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="/UI/Home.aspx">
<img id="MMLogo" src="/Images/Logo/MM.jpg" alt="MurkyMuse Logo" Title="MurkyMuse Logo" />
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="/UI/Home.aspx">HOME<span class="sr-only">(current)</span></a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">DAILY LIFE
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="/UI/ComingSoon.aspx">Art</a></li>
<li><a href="/UI/ComingSoon.aspx">Outfits</a></li>
</ul>
</li>
<li><a href="/UI/Shop/Shop.aspx">SHOP</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="/UI/About.aspx">ABOUT<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="/UI/About/OurStory.aspx">OUR STORY</a></li>
<li><a href="/UI/ComingSoon.aspx">MEDIA</a></li>
</ul>
</li>
<li><a href="/UI/Contact.aspx">CONTACT</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
答案 0 :(得分:1)
Cart 菜单项的行为与标准链接不同,因为您已在其上定义了data-toggle="dropdown"
。作为下拉功能的一部分,Bootstrap单击侦听器对在这些元素上触发的单击事件使用Event.preventDefault()
,从而阻止本机链接行为。
如果购物车项目没有下拉列表,但它应该作为标准链接,请从中移除data-toggle="dropdown"
属性和.dropdown-toggle
类,并且它应该工作。