我想在我的“AdminLayout.cshtml”中添加 jquery 手风琴菜单。当我在根目录中使用所有代码时,菜单确实有效,但是当我将它们添加到管理区域的“AdminLayout.cshtml”时,它的 JavaScript 代码不起作用!我的轮回是真的。为什么?
jQuery代码:
<script type="text/javascript">
$(document).ready(function ($) {
$('#accordion-3').dcAccordion({
eventType: 'click',
autoClose: false,
saveState: false,
disableLink: false,
showCount: false,
speed: 'slow'
});
</script>
html代码:
<ul class="accordion" id="accordion-3">
<li><a href="#">Home</a> <ul>
<li><a href="#">Page 1</a></li>
<li><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
<li><a href="#">Page 4</a></li>
</ul></li>
<li><a href="#">Products</a><ul>
<li><a href="#">Mobile Phones & Accessories</a><ul>
<li><a href="#">Product 1</a>
<ul>
<li><a href="#">Part A</a> </li>
<li><a href="#">Part B</a></li>
<li><a href="#">Part C</a></li>
<li><a href="#">Part D</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#">Accessories</a>
<ul>
<li><a href="#">Product 14</a></li>
<li><a href="#">Product 15</a></li>
</ul>
</li>
</ul></li>
</ul>
并使用这些文件:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="../../Scripts/jquery.cookie.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.hoverIntent.minified.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.dcjqaccordion.2.7.min.js" type="text/javascript"></script>