问题描述
使用jquery v1.3.2和jQuery UI 1.7.1
using jquery v1.3.2 and jQuery UI 1.7.1
我有1个选项卡控件,其中有3个选项卡.每个选项卡包含1个手风琴控件.
I have 1 tab control with 3 tabs in it. Each tab contains 1 accordion control.
$(document).ready(function() {
$('#acc1').accordion({ collapsible: true, autoHeight: false });
$('#acc1').accordion({ collapsible: true, autoHeight: false });
$('#acc1').accordion({ collapsible: true, autoHeight: false });
$('#tabControl').tabs();
});
tabControl在页面加载时不可见.有一个可以打开它的按钮.
tabControl is not visible at page load. There is button that opens it.
$("#btnShow").bind("click", function() {
$('#tabControl').slideToggle("slow");
});
我找不到使所有手风琴控件合拢的方式.每次显示tabControl时,其中的手风琴都会始终展开第一项.
I can't find the way to have all accordion controls collapsed. Every time I show tabControl, accordions in it have first item always expanded.
我已经尝试过了:
$('#acc1First').css('display', 'none');
$('#acc2First').css('display', 'none');
$('#acc3First').css('display', 'none');
$('#acc1First').slideUp();
$('#acc2First').slideUp();
$('#acc3First').slideUp();
但有时会出现问题,必须单击两次才能正常工作等.
but it bugges sometimes, first item have to be clicked 2 times to work properly etc.
有什么办法可以使所有折叠的物品初始化手风琴控制吗?
Is there any way to initialize accordion control with all items collapsed ?
谢谢
推荐答案
尝试一下
$('#acc1').accordion({
collapsible: true,
autoHeight: false,
active: false
});
这篇关于jQuery手风琴开放折叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!