我刚刚开始使用 jQuery 选项卡,它看起来很棒。我想将它们用作我的导航菜单ASP.NET MVC
。我清理了site.css
并在我的_Layout.cshtml
. 我可以看到菜单,但它没有按我的意愿正常工作。无论我选择哪个链接,它每次都会加载主页(它也显示预期的页面,但在主页的内容下方)。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title - My ASP.NET MVC Application</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
@Styles.Render("~/Content/themes/base/css")
@Styles.Render("~/Content/bootstrap")
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
@Scripts.Render("~/bundles/bootstrap")
<script>
$(function () {
$("#tabs").tabs({ active: false });
});
</script>
</head>
<body>
<header>
<div >
<div >
<p >@Html.ActionLink("your logo here", "Index", "Home")</p>
</div>
<div >
<section>
Hello, <span >@User.Identity.Name</span>!
</section>
<nav>
<div id = "tabs">
<ul >
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
</div>
</nav>
</div>
</div>
</header>
<div >
@RenderSection("featured", required: false)
<section class="content-wrapper main-content clear-fix">
@RenderBody()
</section>
</div>
<footer>
<div >
<div >
<p>© @DateTime.Now.Year - My ASP.NET MVC Application</p>
</div>
</div>
</footer>
@RenderSection("scripts", required: false)
</body>
</html>