jquery 手风琴“销毁” 不工作
我正在使用 jQuery Accordion,并希望制作一个可打印的页面,其中所有“手风琴”都已展开。 我找到了 .accordion( 'destroy' ) 选项。 但是,当我实现它时,单击销毁按钮后仅显示现有的可见 div。 任何帮助,将不胜感激。
<link type="text/css" href="/js/theme/ui.all.css" rel="Stylesheet" />
<script type="text/javascript" src="/js/jquery-ui-personalized-1.6rc6.js"></script>
<script type="text/javascript">
$(function(){
// Accordion
$("#accordion").accordion({ header: "h2", autoHeight: false, animated: false });
//attach click hander to button
$("#accordionKiller").click(function() {
//destroy the accordion
$("#accordion").accordion('destroy');
});
});
</script>
<a id="accordionKiller">Printable version</a>
<div id="accordion">
<div>
<h2><a href="#">Services</a></h2>
<div class="services">
</div>
</div>
</div>
I'm using jQuery Accordion and would like to make a printable page where all the "accordions" are expanded. I found the .accordion( 'destroy' ) option. However, when I implement it only the existing visible div is show after click the destroy button. Any help would be appreciated.
<link type="text/css" href="/js/theme/ui.all.css" rel="Stylesheet" />
<script type="text/javascript" src="/js/jquery-ui-personalized-1.6rc6.js"></script>
<script type="text/javascript">
$(function(){
// Accordion
$("#accordion").accordion({ header: "h2", autoHeight: false, animated: false });
//attach click hander to button
$("#accordionKiller").click(function() {
//destroy the accordion
$("#accordion").accordion('destroy');
});
});
</script>
<a id="accordionKiller">Printable version</a>
<div id="accordion">
<div>
<h2><a href="#">Services</a></h2>
<div class="services">
</div>
</div>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
调用 Accordion destroy 后,您需要将内容 div 设置为可见。
根据您链接到的页面,我将在 $("#accordion").accordion('destroy') 行之前添加此内容:
After you call the accordion destroy, you need to set the content divs to be visible.
Based on the page you linked to I would add this before the $("#accordion").accordion('destroy') line: