Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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
Trades: 0
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
 
 
Register now for full access!
Reply     « Reply to Positioning Layers Relative To Center Of Window
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.08267 seconds with 12 queries