Side navigation
#4500 closed bug (duplicate)
Opened April 06, 2009 09:07PM UTC
Closed April 22, 2009 05:34AM UTC
Dimensions methods return 0 if a parent has display: none
Reported by: | Marc Diethelm | Owned by: | brandon |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | dimensions | Version: | 1.3.2 |
Keywords: | Cc: | boo@chic-happens.ch | |
Blocked by: | Blocking: |
Description
Methods like height, innerHeight, outerWidth, etc. all return 0 if a parent of the selected element has display: none.
Attachments (0)
Change History (3)
Changed April 11, 2009 02:58PM UTC by comment:1
Changed April 20, 2009 01:01PM UTC by comment:2
I really hope this can be fixed. If you need to use jQuery to precisely position elements, say in widget, while the widget itself is still hidden (display:none) you're bummed. Another more common case: any operation of this kind in a tab that is not currently selected.
In case this can't be done feasibly, the documentation should say so. It actually took me awhile to realize what the problem was when I encountered this problem. Also the method returning 0 is clearly wrong IMO. If no dimension can be returned the value should be null or false.
I think this is intended behavior. If the element itself is hidden the methods will unhide it long enough to get the dimensions.