]> source.dussan.org Git - jquery-ui.git/commitdiff
accordion: another partial fix for #4011, fixes tests/visual/accordion/width.html...
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Sat, 31 Jan 2009 16:52:52 +0000 (16:52 +0000)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Sat, 31 Jan 2009 16:52:52 +0000 (16:52 +0000)
ui/ui.accordion.js

index 6ce36ec45f7918363a50f459fb2d412c9bf24db3..62f038a1a4e5afe5a7afb7c4d45876d75dc3c56d 100644 (file)
@@ -398,7 +398,14 @@ $.extend($.ui.accordion, {
                                percentDone,
                                showProps = {},
                                hideProps = {},
-                               fxAttrs = [ "height", "paddingTop", "paddingBottom" ];
+                               fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
+                               originalWidth;
+                       // fix width before calculating height of hidden element
+                       if (options.toShow[0]) {
+                               var s = options.toShow;
+                               originalWidth = s[0].style.width;
+                               s.width( parseInt(s.parent().width()) - parseInt(s.css("paddingLeft")) - parseInt(s.css("paddingRight")) - parseInt(s.css("borderLeftWidth")) - parseInt(s.css("borderRightWidth")) );
+                       }
                        $.each(fxAttrs, function(i, prop) {
                                hideProps[prop] = 'hide';
                                
@@ -431,8 +438,9 @@ $.extend($.ui.accordion, {
                                easing: options.easing,
                                complete: function() {
                                        if ( !options.autoHeight ) {
-                                               options.toShow.css("height", "auto");
+                                               options.toShow.css("height", "");
                                        }
+                                       options.toShow.css("width", originalWidth);
                                        options.toShow.css({overflow: overflow});
                                        options.complete();
                                }