Opened 16 years ago
Closed 16 years ago
#961 closed bug (worksforme)
Calling $("#thing").width() causes rendering problems.
Reported by: | 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 16 years ago by
need: | → Test Case |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
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.