/    Sign up×
Community /Pin to ProfileBookmark

Centering a page larger than the Window size

Hey,

Im having a bit of an issue with a website im building for a band.

The band want a site that is 2500 width so that when the page loads you can either scroll roght or left to view the out of screen material…

i cant find a way of the page loading centered…it is always loading to the far left and all i can do is scroll right…i have uploaded the site to [url]http://www.testingserver.comuv.com[/url]

I origionally posted this thread in the CSS forum but was instructed this would be a Javascript issue

Any help with this would be really appreciated as i cant find any other threads on this specific issue.

thanks very much.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@vwphillipsNov 15.2010 — [CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
#vocals {
background-image: url(Images/vocals%20BG.png);
height:200px;
width: 2500px;
overflow: auto;
left: 0%;
}

/*]]>*/
</style></head>

<body>
<div id="vocals" ></div>
<script type="text/javascript">
/*<![CDATA[*/

function zxcWWHS(){
if (window.innerHeight) return [window.innerWidth-10,window.innerHeight-10,window.pageXOffset,window.pageYOffset];
else if (document.documentElement.clientHeight) return [document.documentElement.clientWidth-10,document.documentElement.clientHeight-10,document.documentElement.scrollLeft,document.documentElement.scrollTop];
return [document.body.clientWidth,document.body.clientHeight,document.body.scrollLeft,document.body.scrollTop];
}

window.scrollTo((document.getElementById('vocals').offsetWidth-zxcWWHS()[0])/2,0);
/*]]>*/
</script></body>

</html>[/CODE]
×

Success!

Help @fraserjohnstone spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...