r1204 - trunk/ui

r1204 - trunk/ui


Author: joern.zaefferer
Date: Mon Dec 22 06:50:59 2008
New Revision: 1204
Modified:
trunk/ui/ui.accordion.js
Log:
accordion: fix for #3626, refactoring resize code into its own public method
Modified: trunk/ui/ui.accordion.js
==============================================================================
--- trunk/ui/ui.accordion.js    (original)
+++ trunk/ui/ui.accordion.js    Mon Dec 22 06:50:59 2008
@@ -47,22 +47,7 @@
            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');
@@ -143,6 +128,26 @@
        }
        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) {