We\'re facing a fairly scary issue in JavaScript that none of us seems to be quite capable of resolving:
How do we get the width and height of a DOM element, including
If the main problem is that you can't get the size before placing it onto the screen I would recommend creating a class that allows the div to be hidden under the page's background. This should work cross browser.
.exampleHidden{
position: absolute;
z-index: -1;
}
If you set the main background of the page's z-index to 0 then attaching the hidden class to your new element it would put it under the background. Assuming it isn't larger than your background it should be hidden for now to allow you to measure and set the height and width before actually bringing it back to the foreground by removing the .exampleHidden class.