Skip to main content

Bug Tracker

Side navigation

#961 closed bug (worksforme)

Opened February 15, 2007 12:12AM UTC

Closed March 28, 2007 01:38AM UTC

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

Reported by: ned.collyer@gmail.co 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.

Attachments (0)
Change History (1)

Changed March 28, 2007 01:38AM UTC by brandon comment:1

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.