让 Accordion 插件在 Ajax 中工作
我的网站使用 AJAX 来呈现内容。当单击主菜单时,page1.html 在 content-div 中打开。在 page1.html 上,我想使用 jQuery 手风琴菜单来呈现内容。如何让它在使用 AJAX 调用的文件中工作?
手风琴菜单要求这些文件当前显示在index.html 中。
<script type="text/javascript" src="jquery.min.js"></script>
<script type='text/javascript' src='jquery.cookie.js'></script>
<script type='text/javascript' src='jquery.hoverIntent.minified.js'></script>
<script type='text/javascript' src='jquery.dcjqaccordion.2.6.min.js'></script>
<script type="text/javascript">
$(document).ready(function($){
$('.accordion-1').dcAccordion({
eventType: 'click',
autoClose: true,
saveState: false,
disableLink: false,
showCount: false,
speed: 'normal'
});
});
</script>
我正在使用 Design Chemicals jquery 垂直手风琴菜单。 http://bit.ly/eIMnl1
My website uses AJAX to present content. When click in main menu, page1.html opens in content-div. On page1.html I want to present content using jQuery accordion menu. How can I get it working in file called with AJAX?
Accordion menu requires these files are currently presented in index.html.
<script type="text/javascript" src="jquery.min.js"></script>
<script type='text/javascript' src='jquery.cookie.js'></script>
<script type='text/javascript' src='jquery.hoverIntent.minified.js'></script>
<script type='text/javascript' src='jquery.dcjqaccordion.2.6.min.js'></script>
<script type="text/javascript">
$(document).ready(function($){
$('.accordion-1').dcAccordion({
eventType: 'click',
autoClose: true,
saveState: false,
disableLink: false,
showCount: false,
speed: 'normal'
});
});
</script>
I'm using Design Chemicals jquery vertical accordion menu. http://bit.ly/eIMnl1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是您在 AJAX 在 content-div 中附加新元素之前运行此插件代码。只需将初始化代码放入 AJAX 请求的成功回调中即可。
The problem is that you are running this plugin code before you AJAX appends the new elements in content-div. Just put the initialization code in the success callback in your AJAX request.