Search and Top Navigation
#4442 closed bug (fixed)
Opened April 07, 2009 10:05AM UTC
Closed August 06, 2009 06:49PM UTC
resize function with autoheight
Reported by: | guile | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.8 |
Component: | ui.accordion | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
based on version 1.7.1.
There is a problem with the resize function for autoHeight when it sets the new height based on the maxHeight. MaxHeight is calculated based on the outerHeight which is normal but then it sets the height of each element based on maxHeight. It should set the height of the element based on maxHeight -(border and padding of this resized element). Below is my bugfix proposition. I tested it and it works.
Current code
from line 191:
} else if ( o.autoHeight ) {
maxHeight = 0;
this.headers.next().each(function() {
maxHeight = Math.max(maxHeight, $(this).outerHeight());
}).height(maxHeight);
}
My solution:
from line 191
} else if ( o.autoHeight ) {
maxHeight = 0;
this.headers.next().each(function() {
maxHeight = Math.max(maxHeight, $(this).outerHeight());
}).height(function(){
return maxHeight-$(this).outerHeight()+$(this).height()
});
}
Attachments (0)
Change History (4)
Changed April 07, 2009 10:28AM UTC by comment:1
Changed April 07, 2009 10:38AM UTC by comment:2
OK sorry again the mistakes above. Here it looks a lot better.
This is what I suggest from line 191:
} else if ( o.autoHeight ) { maxHeight = 0; this.headers.next().each(function() { maxHeight = Math.max(maxHeight, $(this).outerHeight()); }).each(function() { var newHeight=maxHeight-$(this).outerHeight()+$(this).height(); $(this).height(newHeight); }); }
Changed April 08, 2009 01:26AM UTC by comment:3
milestone: | TBD → 1.8 |
---|
Changed August 06, 2009 06:49PM UTC by comment:4
resolution: | → fixed |
---|---|
status: | new → closed |
Fixed in r3038. The change is to just use height() instead of outerHeight(), making it much simpler then what you proposed.
Please reopen this ticket if that isn't enough for you, preferably with a usecase included.
Sorry but I made a mistake.
This is a better code
} else if ( o.autoHeight ) {
maxHeight = 0;
this.headers.next().each(function() {
maxHeight = Math.max(maxHeight, $(this).outerHeight());
}).each(function() {
var newHeight=maxHeight-$(this).outerHeight()+$(this).height();(this).height(newHeight);
});
}