Opened 14 years ago
Closed 14 years ago
#4500 closed bug (duplicate)
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: | [email protected]… | |
Blocked by: | Blocking: |
Description
Methods like height, innerHeight, outerWidth, etc. all return 0 if a parent of the selected element has display: none.
Change History (3)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
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.