我有一个局部视图,我有一个类别列表,但我想使用jqWidget菜单,我已经做了参考
<link rel="stylesheet" href="../../Content/jqwidgets/styles/jqx.base.css" type="text/css" />
<link rel="stylesheet" href="../../Content/jqwidgets/styles/jqx.base.css" type="text/css"/>
<script type="text/javascript" src="../../Scripts/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../../Content/scripts/gettheme.js"></script>
<script type="text/javascript" src="../../Content/jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="../../Content/jqwidgets/jqxmenu.js"></script>
<script type="text/javascript" src="../../Content/jqwidgets/jqxcheckbox.js"></script>
<link rel="stylesheet" href="../../Content/jqwidgets/styles/jqx.fresh.css" type="text/css" />
但是他们只是像普通的li标签一样显示,我使用的是MVC 4,这是代码的其余部分:
<body>
<div id='content'>
<script type="text/javascript">
$(document).ready(function () {
$("#Menu").jqxMenu({ mode: 'vertical', theme: 'fresh' });
$("#Menu").css('visibility', 'visible');
});
</script>
<div id='Menu'>
<div >
<ul>
@foreach (var category in Model)
{
<li>
<a>@Html.ActionLink(category.Name, "Browse", "Store", new { Category = category.Name }, null)</a>
</li>
}
</ul>
</div>
</div>
</div>
</body>
答案 0 :(得分:0)
据我说,HTML结构不正确。菜单需要在DIV标签下面的UL标签,这里有2个嵌套的DIV标签。
答案 1 :(得分:0)
我找到了解决方案,似乎_layout页面没有加载引用,所以我在每个视图中包含了引用,现在它可以正常工作。