Bug Tracker

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:


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 dmethvin

I think this is intended behavior. If the element itself is hidden the methods will unhide it long enough to get the dimensions.

comment:2 Changed 14 years ago by Marc Diethelm

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.

comment:3 Changed 14 years ago by brandon

Resolution: duplicate
Status: newclosed

duplicate of #3011

Note: See TracTickets for help on using tickets.