diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2008-12-22 14:50:59 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2008-12-22 14:50:59 +0000 |
commit | 02e8e4d298f791b0ae962062d06f268e3c268afb (patch) | |
tree | 848c88a0bb413f074cf8a4b00fbf235812711bbe /ui/ui.accordion.js | |
parent | 47938b305e831e5a026e5a640122188fa7a2485a (diff) | |
download | jquery-ui-02e8e4d298f791b0ae962062d06f268e3c268afb.tar.gz jquery-ui-02e8e4d298f791b0ae962062d06f268e3c268afb.zip |
accordion: fix for #3626, refactoring resize code into its own public method
Diffstat (limited to 'ui/ui.accordion.js')
-rw-r--r-- | ui/ui.accordion.js | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/ui/ui.accordion.js b/ui/ui.accordion.js index 3a8c2e9d0..2fc1cefb3 100644 --- a/ui/ui.accordion.js +++ b/ui/ui.accordion.js @@ -47,22 +47,7 @@ $.widget("ui.accordion", { this.element.find('a').css('zoom', '1'); } - var maxHeight; - if ( options.fillSpace ) { - maxHeight = this.element.parent().height(); - options.headers.each(function() { - maxHeight -= $(this).outerHeight(); - }); - var maxPadding = 0; - options.headers.next().each(function() { - maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height()); - }).height(maxHeight - maxPadding); - } else if ( options.autoHeight ) { - maxHeight = 0; - options.headers.next().each(function() { - maxHeight = Math.max(maxHeight, $(this).outerHeight()); - }).height(maxHeight); - } + this.resize(); this.element.attr('role','tablist'); @@ -144,6 +129,26 @@ $.widget("ui.accordion", { return true; }, + + resize: function() { + var options = this.options, + maxHeight; + if ( options.fillSpace ) { + maxHeight = this.element.parent().height(); + options.headers.each(function() { + maxHeight -= $(this).outerHeight(); + }); + var maxPadding = 0; + options.headers.next().each(function() { + maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height()); + }).height(maxHeight - maxPadding); + } else if ( options.autoHeight ) { + maxHeight = 0; + options.headers.next().each(function() { + maxHeight = Math.max(maxHeight, $(this).outerHeight()); + }).height(maxHeight); + } + }, activate: function(index) { // call clickHandler with custom event |