开发者

jQuery UI tabs not rendering

I get no javascript or markup errors with the code below, but I don't get any tabs either

[_Layout.cshtml]

<html>
<head>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/_Layout.js")" type="text/javascript"></script>
</head>

Any help is appreciated.

Thanks.

<body>
<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Nunc tincidunt</a></li>
    </ul>
    <div id="tabs-1">
        <p&g开发者_运维技巧t;Tab 1 content</p>
    </div>
</div>
</body>
</html>

[_Layout.js]

$(document).ready(function () {
    $("#tabs").tabs();
});

[Index.cshtml]

@{
    ViewBag.Title = "Home Page";
}
<h2>@ViewBag.Message</h2>

Generated html:

<!DOCTYPE html>

<html>

<head>

    <title>Home Page</title>

    <link href="/Content/Site.css" rel="stylesheet" type="text/css" />

    <script src="/Scripts/jquery-1.4.4.min.js" type="text/javascript"></script>

    <script src="/Scripts/jquery-ui.min.js" type="text/javascript"></script>

    <script src="/Scripts/_Layout.js" type="text/javascript"></script>

</head>



<body>

    <div class="page">

        <div id="header">

            <div id="title">

                <h1>My MVC Application</h1>

            </div>

         <br />

    <div id="tabs">

       <ul>

          <li><a href="#tabs-1">Nunc tincidunt</a></li>

       </ul>

       <div id="tabs-1">

          <p>Tab 1 content</p>

       </div>

    </div>



        <div id="main">



<h2>Welcome to ASP.NET MVC!</h2>

<p>

    To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.

</p>



            <div id="footer">

            </div>

        </div>

    </div>

    </div>

</body>

</html>

For completeness I forgot to include the jquery ui css file:

<link href="@Url.Content("~/Content/themes/base/jquery-ui.css")" rel="stylesheet" type="text/css" />

Thanks @Paul


Try adding this to your head tag:

<link type="text/css" rel="Stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/redmond/jquery-ui.css" /> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜