Reply
Positioning Layers Relative To Center Of Window
Old 04-26-2005, 08:01 AM Positioning Layers Relative To Center Of Window
Dorian_Fabre's Avatar
Novice Talker

Posts: 7
I'm using the following Javascript to position layers offset from the center of the screen, so that they all are always is the same position relative to each other, with the overall layout centered whatever the screen size. (This is just the IE script, I'll get on to other browsers afterwards)

function middle() {
var width;
if (document.all) {
width = document.body.offsetWidth;
document.all('Background').style.width = width - 20;
document.all('BigLogo').style.posLeft = (width / 2) - 400 + 27;
document.all('MainMenu').style.posLeft = (width / 2) - 400;
document.all('Content').style.posLeft = (width / 2) - 400 + 75;
document.all('URLphone').style.posLeft = (width / 2) - 400 + 464;
document.all('BigImage').style.posLeft = (width / 2) - 400 + 558;
if (document.all('SubMenuFrame')) {document.all('SubMenuFrame').style.width = width - 20;}
document.all('BottomFrame').style.width = width - 20;
document.all('ASGhome').style.posLeft = (width / 2) - 400;
document.all('SykesHome').style.posLeft = (width / 2) - 400 + 657;
}
}

The problem is that the page first loads left-aligned before the screen dimensions are measured, then the whole lot is moved to the middle. This happens every time a page is loaded for the first time. You can see it here

Is there any way to have the layers appear in the correct position so there's no movement on the page?

Cheers
Dorian
Dorian_Fabre is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Reply     « Reply to Positioning Layers Relative To Center Of Window
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11064 seconds with 12 queries