So why don't you just set autoheight
to false?
$( ".selector" ).accordion({ autoHeight: false });
http://jqueryui.com/demos/accordion/#option-autoHeight
EDIT
Looking at your comment:
// Accordion
$("#accordion").accordion({ header: "h3" });
$("#accordion").accordion({ collapsible: true });
$("#accordion").accordion({ autoHeight: false, navigation: true });
你先初始化手风琴,然后再添加更多选项.你为什么这么做?autoHeight
的默认值为true
,因此每个选项卡都有一个固定的高度.将所有选项放在一次通话中:
// Accordion
$("#accordion").accordion({
header: "h3",
collapsible: true,
autoHeight: false,
navigation: true
});
EDIT
关于你的第二条 comments :
Have a look at http://jqueryui.com/demos/accordion/#option-header. You can see that option h3
is set by default, so you don't have to set it in your call.
And you get an answer to your question here: JQuery accordion doesn't work without h3 tags.
通过jQueryAPI来提高知识水平是非常重要的.对于jQuery API,转到http://api.jquery.com/;对于jQuery UI,转到http://jqueryui.com/demos/.如果你还有任何问题,请毫不犹豫地问after你试图解决你的问题,after你做了一些研究.
如果所有这些都回答了你的问题,请将其标记为正确答案.