Page 1 of 1

Horizontal scrolling website

Posted: Tue Aug 24, 2010 5:30 am
by Manak
Hi there,

I was just reading one tutorial one dude made for The Web Squeeze about an
horizontal scrolling website.

http://www.thewebsqueeze.com/web-design ... bsite.html

and the demo:

http://www.thewebsqueeze.com/samples/ho ... jquery-on/

I was wondering if you were able to help me on this:
In the demo, when you click on for example the" BOX 3" link in the menu, it scrolls
till the box3 content is left-aligned to the screen. Do you think it is possible to have it centered on the screen?

thanks! :)


Manuel.

Re: Horizontal scrolling website

Posted: Tue Aug 24, 2010 5:29 pm
by pickle
In that example, centering wouldn't be good, as the previous (box 2) content would still show a bit and the user would have to scan to find the content.

But, not having looked at the code, I imagine what it's doing is finding the left coordinate of box 3 and scrolling the window until the box is to a desired position. All you have to do is change that desired position from being the left of the screen, to a position that would center the box.

The formula you could use would be:

windowWidth/2 - box3width/2 = new left coordinate of box 3

Re: Horizontal scrolling website

Posted: Wed Aug 25, 2010 2:36 am
by Manak
Oh thank you so much! :)