基本上插件不会加载,我只能获得无聊的外观列表而不是一个好的Accordion菜单,如预期的那样:(
当我尝试“Hello World'测试Javascript,它工作正常,但手风琴让我望而却步。
请 - 我做错了什么?
我的标题:
<head>
<script type='text/javascript' src='js/jquery.cookie.js'></script>
<script type='text/javascript' src='js/jquery.hoverIntent.minified.js'></script>
<script type='text/javascript' src='js/jquery.dcjqaccordion.2.7.min.js'></script>
<script type="text/javascript">
$(document).ready(function($){
$('.accordion-1').dcAccordion({
eventType: 'hover',
autoClose: true,
saveState: true,
disableLink: true,
menuClose: false,
speed: 'medium',
showCount: true,
autoExpand: true,
cookie : 'dcjq-accordion-1',
classExpand : 'dcjq-current-parent',
menuClose: false
});
});
</script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Home Page</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/normalize.min.css">
<link rel="stylesheet" href="css/main.css">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script>window.html5 || document.write('<script src="js/vendor/html5shiv.js"><\/script>')</script>
<![endif]-->
</head>
这是文件正文:
<body>
<div class="header-container">
<header class="wrapper clearfix">
<h1 class="title">h1.title</h1>
</header>
</div>
<div class="main-container">
<div class="main wrapper clearfix">
<aside>
<ul id="accordion-1" class="menu">
<li><a href="#">Item 1</a>
<ul>
<li><a href="#">Sub-Item 1 a</a></li>
<li><a href="#">Sub-Item 1 b</a></li>
<li><a href="#">Sub-Item 1 c</a></li>
</ul>
</li>
<li><a href="#">Item 2</a>
<ul>
<li><a href="#">Sub-Item 2 a</a></li>
<li><a href="#">Sub-Item 2 b</a></li>
</ul>
</li>
<li><a href="#">Item 3</a>
<ul>
<li><a href="#">Sub-Item 3 a</a></li>
<li><a href="#">Sub-Item 3 b</a></li>
<li><a href="#">Sub-Item 3 c</a></li>
<li><a href="#">Sub-Item 3 d</a></li>
</ul>
</li>
<li><a href="#">Item 4</a>
<ul>
<li><a href="#">Sub-Item 4 a</a></li>
<li><a href="#">Sub-Item 4 b</a></li>
<li><a href="#">Sub-Item 4 c</a></li>
</ul>
</li>
</ul>
</aside>
</div> <!-- #main -->
</div> <!-- #main-container -->
<div class="footer-container">
<footer class="wrapper">
<h3>footer</h3>
</footer>
</div>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
</body>
我应该提到我也尝试使用此代码初始化,而不是上面的代码:
jQuery(document).ready(function($) {
jQuery('#accordion-1').dcAccordion();
});
</script>
答案 0 :(得分:1)
在head标记下添加以下脚本块,解决了问题:
<head>
<script type='text/javascript' src='js/jquery-1.7.2.min.js'></script>
是的,这有点令人尴尬:)。