我正在尝试将jQuery明细菜单添加到我的网络应用程序中。我已按照说明here并复制了here的源代码。当我将所有内容添加到我的项目并将代码添加到我的_layout.cshtml网站时,向下钻取菜单不起作用,该页面看起来像嵌套无序列表的常规树结构。
jQuery这是在head标签中:
<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>
答案 0 :(得分:2)
更改
<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>
网址附加的双引号是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>