gpt4 book ai didi

jquery - 网站发布后,Bootstrap 3 导航栏无法正常工作

转载 作者:太空宇宙 更新时间:2023-11-03 18:15:10 24 4
gpt4 key购买 nike

我开发了一个站点,当我在 visual studio 2012 中对其进行调试时,一切正常。虽然发布后,我的导航下拉菜单不起作用。看起来它只是在当前 url 的末尾放置了一个#。我正在使用主/内容页面设置,据我所知它看起来像一个 jquery 问题。虽然不确定如何解决问题。任何帮助将不胜感激。

这些在母版页标题中:

<link href="../Content/bootstrap.css" rel="stylesheet" />
<link href="../Content/external-theme.css" rel="stylesheet" />

Mast 页面正文:

<body>
<form id="form1" runat="server">
<div>
<div class="container">
<nav class="navbar navbar-default" id="navbar" role="navigation">

<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1">
<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.aspx">
<img src="Images/XXXX.png" class="img-responsive" alt="logo" />
</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="Home.aspx">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Products & Services <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="Consulting.aspx">Consulting</a></li>
<li><a href="SpaceFiller.aspx">Space Filler</a></li>
<li><a href="Documentation.aspx">Product Documentation</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Careers <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="Company.aspx">Company</a></li>
<li><a href="Openings.aspx">Openings</a></li>
</ul>
</li>
<%--<li><a href="Customer.aspx">Customer Portal</a></li>--%>
<li><a href="Contact.aspx">Contact Us</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
<!-- /.container-fluid -->
</nav>
</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
<script src="/Scripts/jquery-2.1.0.js"></script>
<script src="/Scripts/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#sidebar').affix({
offset: {
top: 290
}
});

var $body = $(document.body);
var navHeight = $('.navbar').outerHeight(true) + 10;

$body.scrollspy({
target: '#leftCol',
offset: navHeight
});
});
</script>

最佳答案

所有需要做的就是删除母版页底部两个 jquery 脚本引用中“Scripts/...”开头的正斜杠。问题解决了。

<script src="Scripts/jquery-2.1.0.js"></script>
<script src="Scripts/bootstrap.min.js"></script>

关于jquery - 网站发布后,Bootstrap 3 导航栏无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22967802/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com