How can you adjust the height of a jQuery UI accordion?

后端 未结 11 1913
礼貌的吻别
礼貌的吻别 2021-01-31 15:32

In my UI I have an accordion setup like this:

Section 1

...content...
//
11条回答
  •  醉酒成梦
    2021-01-31 16:15

    It looks like all the answers here are now using deprecated options.

    With the latest version of jQuery UI (1.10.x), you should initialize your accordion with heightStyle: "fill" to get the intended effect..

    $(".selector").accordion({ heightStyle: "fill" });
    

    You can read more at the jQuery UI API docs here: http://api.jqueryui.com/accordion/#option-heightStyle

    If your page dimensions change dynamically and you need to recalculate your accordion size, you should refresh your accordion using the refresh method:

    $(".selector").accordion("refresh");
    

    This is preferred as the resize method is now deprecated.

提交回复
热议问题