动态jQuery的手风琴
-
23-09-2019 - |
题
如何我默认的手风琴在启动时关闭。这里是示例视图这里
下面是代码:
<script>
$(function() {
$("#accordion").tabs("#accordion div.pane", {tabs: 'h3', effect: 'slide'});
});
</script>
<script>
// add new effect to the tabs
$.tools.tabs.addEffect("slide", function(i, done) {
// 1. upon hiding, the active pane has a ruby background color
this.getPanes().slideUp("slow").css({backgroundColor: "#fff"});
// 2. after a pane is revealed, its background is set to its original color (transparent)
this.getPanes().eq(i).slideDown("slow", function() {
$(this).css({backgroundColor: 'transparent'});
// the supplied callback must be called after the effect has finished its job
done.call();
});
});
</script>
解决方案
您可以做这样的:
$("#accordion")
.tabs("#accordion div.pane", {tabs: 'h3', effect: 'slide', collapsible: true})
.tabs('select', false);
此将其标记为collapsible
,然后选择一个选项卡,这不是在那里显示,使用false
。
其他提示
放在你的CSS:
#accordion div.pane: display:none;
不隶属于 StackOverflow