I'm trying to start each page after the homepage about 500px down, similar to this website: http://unionstationdenver.com/
You'll notice when viewing pages after the homepage, you're automatically scrolled down without notice but you can than scroll up to revel the featured slider again.
I've played with scrolledHeight but I dont think that is what I need????
Basically I have a featured section that is on top of all my content pages, but you shouldn't be able to see this section until you scroll up. Any help?
You can use
.scrollIntoView()
for this. It will bring a specific element into the viewport.Example:
Demo: http://jsfiddle.net/ThinkingStiff/DG8yR/
Script:
HTML:
CSS:
here is the example using Pure JavaScript
You can use two different techniques to achieve this.
The first one is with javascript: set the scrollTop property of the scrollable element (e.g.
document.body.scrollTop = 1000;
).The second is setting the link to point to a specific id in the page e.g.
Then if in your target page you'll have that ID the page will be scrolled automatically.
Use
document.scrollTop
to change the position of the document. Set thescrollTop
of thedocument
equal to thebottom
of the featured section of your site