Bug Tracker

Modify

Ticket #11944 (closed bug: duplicate)

Opened 11 months ago

Last modified 11 months ago

Incorrect calculation of dimensions when parent hidden

Reported by: Brandon Paluzzi <brandon@…> Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

If you meet the following criteria: 1 - A block level parent element is set to display: none 2 - A block level child element has width/height set as a percentage

Then the jQuery functions height() and width() do not work as intended. Instead of calculating the correct pixel size (or returning undefined), they simply drop the percent sign from the CSS-defined width and report that back: e.g., 75% becomes "75"

 http://jsfiddle.net/CaJNB/20/

Change History

comment:1 Changed 11 months ago by damien

This is an issue of window.getComputedStyle() it will deliver the percentage (including %) instead of the pixel size. I don't think there is a way to receive the "real" pixel size from a build-in function... so calculate through iteration or just ignore it and append the '%' again.

 http://jsfiddle.net/gb7pp/1/

comment:2 Changed 11 months ago by mikesherov

  • Status changed from new to closed
  • Resolution set to duplicate

comment:3 Changed 11 months ago by mikesherov

Duplicate of #9945.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.