为什么我的jQuery钻下菜单不工作



我试图将jQuery钻下菜单添加到我的web应用程序。我遵循这里的说明,并从这里复制源代码。当我把所有的东西添加到我的项目和代码到我的_layout。CSHTML站点下钻菜单不起作用,页面看起来像嵌套无序列表的常规树结构。

jQuery这是在头部标签:

    <script src="@Url.Content("~/Scripts/jquery.cookie.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.dcdrilldown.1.2.min.js")"></script>
    <script type="text/javascript">
                    $(document).ready(function() {
            $('#drilldown').dcDrilldown({
                speed: 'slow',
                saveState: true,
                showCount: false,
                linkType: 'breadcrumb'
            });
        });
    </script>
Html:

 <ul class="pull-left span1" id="drilldown">
            <li><a href="#">Record Check</a></li>
            <li><a href="#">Reports/Statistics</a></li>
            <ul>
                <li><a href="#">USN</a></li>
                <ul>
                    <li><a href="#">Aclohol Incidents and Status Reports</a></li>
                    <ul>
                        <li><a href="#">Alcohol Incidents(By FY)</a></li>
                        <ul>
                            <li><a href="#">Fiscal Year</a></li>
                            <li><a href="#">Category</a></li>
                        </ul>
                        <li><a href="#">Alcohol Status Reports</a></li>
                    </ul>
                    <li><a href="#">Urinalysis Reports</a></li>
                    <li><a href="#">DAAR Listing</a></li>
                    <li><a href="#">Laboratory Positive Status Report</a></li>
                    <li><a href="#">Screening Listing</a></li>
                    <li><a href="#">Group Profile</a></li>
                    <ul>
                        <li><a href="#">With Details</a></li>
                        <li><a href="#">Without Details</a></li>
                    </ul>
                    <li><a href="#">Unit Profile</a></li>
                    <li><a href="#">ADMITS User and UIC Listings</a></li>
                    <ul>
                        <li><a href="#">ADMITS User Listing</a></li>
                        <li><a href="#">UIC Listing</a></li>
                    </ul>
                </ul>
                <li><a href="#">USMC</a></li>
                <li><a href="#">STAFF</a></li>
                <li><a href="#">DAPA/UPC</a></li>
            </ul>
            <li><a href="#">DAAR Data</a></li>
            <li><a href="#">Training</a></li>
            <li><a href="#">Edit Unit</a></li>
            <li><a href="#">Screening</a></li>
            <li><a href="#">Facility</a></li>
            <li><a href="#">Treatment</a></li>
            <li><a href="#">Waiver Data</a></li>
            <li><a href="#">New Report - Test</a></li>
            <li><a href="#">UIC Search</a></li>
            <li><a href="#">Spice</a></li>
            <li><a href="#">Breathalyzer</a></li>
        </ul>

关于为什么我的钻下菜单不出现的任何想法?

我应该提到这是一个MVC4应用程序,所以两组双引号是必需的。

更新2

作为请求,我的页面源看起来像:

<head>
    <title>Home Page</title>
    <link href="/Content/bootstrap/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/Content/base-admin.css" rel="stylesheet" type="text/css" />
    <link href="/Content/base-admin-responsive.css" rel="stylesheet" type="text/css" />
    <link href="/Content/fontAwesome/font-awesome.css" rel="stylesheet" type="text/css" />
    <script src="/Scripts/jquery-1.9.1.min.js"></script>
    <script src="/Scripts/bootstrap.js"></script>
    <script src="/Scripts/excanvas.min.js"></script>
    <script src="/Scripts/jquery.cookie.js"></script>
    <script runat="server" src="/Scripts/jquery.dcdrilldown.1.2.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $('#drilldown').dcDrilldown({
                speed: 'slow',
                saveState: true,
                showCount: false,
                linkType: 'breadcrumb'
            });
        });
    </script>
</head>
    <div class="pull-left span1">
        <ul id="drilldown">
            <li><a href="#">Record Check</a></li>
            <li><a href="#">Reports/Statistics</a></li>
            <ul>
                <li><a href="#">USN</a></li>
                <ul>
                    <li><a href="#">Aclohol Incidents and Status Reports</a></li>
                    <ul>
                        <li><a href="#">Alcohol Incidents(By FY)</a></li>
                        <ul>
                            <li><a href="#">Fiscal Year</a></li>
                            <li><a href="#">Category</a></li>
                        </ul>
                        <li><a href="#">Alcohol Status Reports</a></li>
                    </ul>
                    <li><a href="#">Urinalysis Reports</a></li>
                    <li><a href="#">DAAR Listing</a></li>
                    <li><a href="#">Laboratory Positive Status Report</a></li>
                    <li><a href="#">Screening Listing</a></li>
                    <li><a href="#">Group Profile</a></li>
                    <ul>
                        <li><a href="#">With Details</a></li>
                        <li><a href="#">Without Details</a></li>
                    </ul>
                    <li><a href="#">Unit Profile</a></li>
                    <li><a href="#">ADMITS User and UIC Listings</a></li>
                    <ul>
                        <li><a href="#">ADMITS User Listing</a></li>
                        <li><a href="#">UIC Listing</a></li>
                    </ul>
                </ul>
                <li><a href="#">USMC</a></li>
                <li><a href="#">STAFF</a></li>
                <li><a href="#">DAPA/UPC</a></li>
            </ul>
            <li><a href="#">DAAR Data</a></li>
            <li><a href="#">Training</a></li>
            <li><a href="#">Edit Unit</a></li>
            <li><a href="#">Screening</a></li>
            <li><a href="#">Facility</a></li>
            <li><a href="#">Treatment</a></li>
            <li><a href="#">Waiver Data</a></li>
            <li><a href="#">New Report - Test</a></li>
            <li><a href="#">UIC Search</a></li>
            <li><a href="#">Spice</a></li>
            <li><a href="#">Breathalyzer</a></li>
        </ul>
    </div>

变化

<script src="@Url.Content("~/Scripts/jquery.cookie.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.dcdrilldown.1.2.min.js")"></script>

<script src="@Url.Content('~/Scripts/jquery.cookie.js')"></script>
<script src="@Url.Content('~/Scripts/jquery.dcdrilldown.1.2.min.js')"></script>

URL周围的额外双引号脱离了src属性引号字符串。


更新:

好的,我想我知道问题出在哪里了。您的HTML无效。<ul>元素的唯一直接子元素必须是<li>元素。嵌套的<ul>元素需要在 <li>标记内的。看一下:
<!-- wrong -->
<ul>
    <li></li>
    <li></li>
    <ul>
        ...
    </ul>
</ul>
<!-- correct -->
<ul>
    <li></li>
    <li>
        <ul>
            ...
        </ul>
    </li>
</ul>

试试这个:

<ul id="drilldown">
    <li><a href="#">Record Check</a></li>
    <li><a href="#">Reports/Statistics</a>
        <ul>
            <li><a href="#">USN</a>
                <ul>
                    <li><a href="#">Aclohol Incidents and Status Reports</a>
                        <ul>
                            <li><a href="#">Alcohol Incidents(By FY)</a>
                                <ul>
                                    <li><a href="#">Fiscal Year</a></li>
                                    <li><a href="#">Category</a></li>
                                </ul>
                            </li>
                            <li><a href="#">Alcohol Status Reports</a></li>
                        </ul>
                    </li>
                    <li><a href="#">Urinalysis Reports</a></li>
                    <li><a href="#">DAAR Listing</a></li>
                    <li><a href="#">Laboratory Positive Status Report</a></li>
                    <li><a href="#">Screening Listing</a></li>
                    <li><a href="#">Group Profile</a>
                        <ul>
                            <li><a href="#">With Details</a></li>
                            <li><a href="#">Without Details</a></li>
                        </ul>
                    </li>
                    <li><a href="#">Unit Profile</a></li>
                    <li><a href="#">ADMITS User and UIC Listings</a>
                        <ul>
                            <li><a href="#">ADMITS User Listing</a></li>
                            <li><a href="#">UIC Listing</a></li>
                        </ul>
                    </li>
                </ul>
            </li>
            <li><a href="#">USMC</a></li>
            <li><a href="#">STAFF</a></li>
            <li><a href="#">DAPA/UPC</a></li>
        </ul>
    </li>
    <li><a href="#">DAAR Data</a></li>
    <li><a href="#">Training</a></li>
    <li><a href="#">Edit Unit</a></li>
    <li><a href="#">Screening</a></li>
    <li><a href="#">Facility</a></li>
    <li><a href="#">Treatment</a></li>
    <li><a href="#">Waiver Data</a></li>
    <li><a href="#">New Report - Test</a></li>
    <li><a href="#">UIC Search</a></li>
    <li><a href="#">Spice</a></li>
    <li><a href="#">Breathalyzer</a></li>
</ul>

相关内容

  • 没有找到相关文章

最新更新