&引用;Jquery选项卡";-Asp.net mvc中的导航菜单样式?

&引用;Jquery选项卡";-Asp.net mvc中的导航菜单样式?,jquery,html,asp.net-mvc,css,Jquery,Html,Asp.net Mvc,Css,我刚刚开始使用jQuery选项卡,它看起来很棒。我想在ASP.NET MVC中将它们用作我的导航菜单。我清理了站点.css,并在我的\u Layout.cshtml中编写了以下代码。我可以看到菜单,但它不能正常工作,因为我想。无论我选择哪个链接,它每次都会加载主页(它也会显示预期页面,但在主页内容下方) @Title-我的ASP.NET MVC应用程序 @style.Render(“~/Content/themes/base/css”) @style.Render(“~/Content/boo

我刚刚开始使用jQuery选项卡,它看起来很棒。我想在
ASP.NET MVC
中将它们用作我的导航菜单。我清理了
站点.css
,并在我的
\u Layout.cshtml
中编写了以下代码。我可以看到菜单,但它不能正常工作,因为我想。无论我选择哪个链接,它每次都会加载主页(它也会显示预期页面,但在主页内容下方)


@Title-我的ASP.NET MVC应用程序
@style.Render(“~/Content/themes/base/css”)
@style.Render(“~/Content/bootstrap”)
@style.Render(“~/Content/css”)
@Scripts.Render(“~/bundles/modernizer”)
@Scripts.Render(“~/bundles/jquery”)
@Scripts.Render(“~/bundles/jqueryui”)
@Scripts.Render(“~/bundles/bootstrap”)
$(函数(){
$(“#tabs”).tabs({active:false});
});
@Html.ActionLink(“您的徽标在此”、“索引”、“主页”)

您好,@User.Identity.Name!
  • @ActionLink(“主页”、“索引”、“主页”)
  • @ActionLink(“关于”、“关于”、“主页”)
  • @ActionLink(“联系人”、“联系人”、“主页”)
@渲染部分(“特色”,必填项:false) @RenderBody() &抄袭@DateTime.Now.Year-我的ASP.NET MVC应用程序

@RenderSection(“脚本”,必需:false)
您似乎已经声明了两次jquery(一次在开头,一次在结尾),这显然是错误的。尝试修复您的脚本:

<!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")
    </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>&copy; @DateTime.Now.Year - My ASP.NET MVC Application</p>
                </div>
            </div>
        </footer>

        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/jqueryui")
        @Scripts.Render("~/bundles/bootstrap")
        @RenderSection("scripts", required: false)
        @Scripts.Render("~/bundles/modernizr")
        <script>
            $("#tabs").tabs({ active: false });
        </script>
    </body>
</html>

@Title-我的ASP.NET MVC应用程序
@style.Render(“~/Content/themes/base/css”)
@style.Render(“~/Content/bootstrap”)
@style.Render(“~/Content/css”)
@ActionLink(“您的徽标在此”、“索引”、“主页”)

您好,@User.Identity.Name!
  • @ActionLink(“主页”、“索引”、“主页”)
  • @ActionLink(“关于”、“关于”、“主页”)
  • @ActionLink(“联系人”、“联系人”、“主页”)
@渲染部分(“特色”,必填项:false) @RenderBody() &抄袭@DateTime.Now.Year-我的ASP.NET MVC应用程序

@Scripts.Render(“~/bundles/jquery”) @Scripts.Render(“~/bundles/jqueryui”) @Scripts.Render(“~/bundles/bootstrap”) @RenderSection(“脚本”,必需:false) @Scripts.Render(“~/bundles/modernizer”) $(“#tabs”).tabs({active:false});
您似乎已经声明了两次jquery(一次在开头,一次在结尾),这显然是错误的。尝试修复您的脚本:

<!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")
    </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>&copy; @DateTime.Now.Year - My ASP.NET MVC Application</p>
                </div>
            </div>
        </footer>

        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/jqueryui")
        @Scripts.Render("~/bundles/bootstrap")
        @RenderSection("scripts", required: false)
        @Scripts.Render("~/bundles/modernizr")
        <script>
            $("#tabs").tabs({ active: false });
        </script>
    </body>
</html>

@Title-我的ASP.NET MVC应用程序
@style.Render(“~/Content/themes/base/css”)
@style.Render(“~/Content/bootstrap”)
@style.Render(“~/Content/css”)
@ActionLink(“您的徽标在此”、“索引”、“主页”)

您好,@User.Identity.Name!
  • @ActionLink(“主页”、“索引”、“主页”)
  • @ActionLink(“关于”、“关于”、“主页”)
  • @ActionLink(“联系人”、“联系人”、“主页”)
@渲染部分(“特色”,必填项:false) @RenderBody() &抄袭@DateTime.Now.Year-我的ASP.NET MVC应用程序

@Scripts.Render(“~/bundles/jquery”) @Scripts.Render(“~/bundles/jqueryui”) @Scripts.Render(“~/bundles/bootstrap”) @RenderSection(“脚本”,必需:false) @Scripts.Render(“~/bundles/modernizer”) $(“#tabs”).tabs({active:false});
您可以发布整个
\u Layout.cshtml
吗?为什么将脚本放在DOM之外?我已经按照要求发布了整个_Layout.cshtml。正如我所说,site.css中没有任何内容。只是尝试使用jquery选项卡创建导航菜单。将脚本放回DOM中,结果仍然相同。正如我所提到的,我可以看到标签,就像我希望它看起来一样,但它不能像我所说的那样正常工作