.height() can be wrong for hidden divs
|Reported by:||remysharp||Owned by:|
If the element is hidden, and if it inherits it's width from a parent element, the height is wrong. The knock on effect is that the slideDown effect jumps.
Working example: http://jsbin.com/opiwe
Uses jQuery 1.3.2 - click 'reveal' to see the jump. Replicated in FF3 and Safari (not tested Opera, but IE reported to fail too).
The issue is the height method is reporting the wrong height for two reasons:
1) When the element is changed to pos:abs the width inherits from the body, i.e. 100% so the height changes. This should swap on the width from the first visible parent.
2) The margins for the first and last nested elements (can be the same element) don't collapse against the edges when they are within a pos:abs.
I've written a patch, but it's untested in IE as yet, and my concern is performance - but I'll be happy to supply the suggested changes if you want them (remy at remy sharp dot com)
If this is fixed, it should fix the animation jumping issues people see in the slide down effects.
Change History (10)
comment:8 Changed 6 years ago by snover
- Resolution set to patchwelcome
- Status changed from new to closed