Bug Tracker

Opened 13 years ago

Closed 13 years ago

#961 closed bug (worksforme)

Calling $("#thing").width() causes rendering problems.

Reported by: ned.collyer@… Owned by: paul
Priority: major Milestone:
Component: dimensions Version:
Keywords: width size Cc:
Blocked by: Blocking:

Description

I'm running Firefox 2 on Kubuntu Edgy.

I've implemented a pretty simple "ajax lightbox".

For the positioning of the popup, I wanted to use:

var popup = $j("popup"); popup.css("left", Math.round($j("body").width() / 2 - popup.width() / 2)); popup.show();

However, the call to popup.width() is causing some of the page divs to loose their padding.

I've had to do the following

var popup = $j("#popup"); popup.css("left", Math.round($j("body").width() / 2 - parseInt(popup.css("width")) / 2)); popup.show();

The popup structure is <div id="#popup">stuff</div>

It is a direct descendant of the body tag. I do not understand how calculating its width can mess with other page elements that are in a separate DOM hierarchy.

Change History (1)

comment:1 Changed 13 years ago by brandon

need: Test Case
Resolution: worksforme
Status: newclosed

I'm not able to reproduce this. You might want to make sure you are using unique ids. Feel free to reopen with a test case.

Note: See TracTickets for help on using tickets.