Skip to main content

Search and Top Navigation

Ticket #4011: ui.accordion.js-fixed-width.patch
File ui.accordion.js-fixed-width.patch, 1.1 KB (added by jzaefferer, January 31, 2009 04:45PM UTC)

Fix width of hidden element before calculating height

Index: /ui/ui.accordion.js
===================================================================
--- /ui/ui.accordion.js	(revision 1934)
+++ /ui/ui.accordion.js	(working copy)
@@ -398,7 +398,14 @@
 				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 @@
 				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();
 				}

Download in other formats:

Original Format