From 02e8e4d298f791b0ae962062d06f268e3c268afb Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Mon, 22 Dec 2008 14:50:59 +0000 Subject: accordion: fix for #3626, refactoring resize code into its own public method --- ui/ui.accordion.js | 37 +++++++++++++++++++++---------------- 1 file 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 -- cgit v1.2.3