Home › Forums › JavaScript › Cool vertical parallax page scroll effect.
- This topic is empty.
-
AuthorPosts
-
March 19, 2011 at 12:22 am #32060Historical Forums UserParticipant
http://www.elderscrolls.com/skyrim/overview/
Has anyone else seen the parallax on the “Elder Scrolls V: Skyrim” site? I thought it was a nice, and appropriate, way to incorporate a vertical parallax effect (which I think is more applicable to many sites). I won’t walk through how it’s accomplished, but here is the function which is called on “domready” pulled from their ‘page_fade.js’ file.
function addParallaxScrolling() {
if (!$("bgImageTop")) {
return
}
if (window.orientation == undefined && !Browser.firefox) {
var body = document.getElement("body"),
headerimage = $("bgImageTop"),
headergrad = $("bgGradientTop");
window.addEvent("scroll", function windowScrollEvent() {
body.setStyle("background-position", "0px " + (this.getScroll().y / 4) + "px");
headerimage.setStyle("top", this.getScroll().y / 4 + "px");
headergrad.setStyle("top", headerimage.getStyle("top").toInt() + headerimage.getStyle("height").toInt() + "px")
})
}
}
March 21, 2011 at 5:56 am #54973sliver37MemberI love the way they didn’t overdo the effect, left it nice and subtle (obviously looks bad when scrolling with the mouse wheel though).
On a side note I totally forgot about the next elders scrolls title, thanks for sticking it back in my sights!
March 21, 2011 at 8:36 am #54982infocentreMemberIt’s nice, but if you use a scrolling-wheel it looks jerky and weird. I actually didnt realise what you were talking about at first as i used my wheel.
REALLY nice when you use the bar though – trippy!
March 21, 2011 at 1:14 pm #54885Historical Forums UserParticipantYeah, I agree with you guys, it is mighty jerky if you have a scroll mouse which step-scrolls (for lack of a better term). I wonder if there is a smoother way of creating that effect.
March 21, 2011 at 7:43 pm #54668TheDocMemberAlso couldn’t tell until I used the scroll bar, which I think is perfect.
The best effects are the ones that the user doesn’t notice, imo.
March 21, 2011 at 10:26 pm #54681Historical Forums UserParticipant@TheDoc – yup, subtle effects are very nice. I think I remember a post a few weeks ago asking for examples of ‘easter eggs’, and while this may not match that full definition, I still think its a special reward for those who notice it.
The part that really makes this for me is the second ‘stone’ background halfway down the page. It’s a nice visual cue that makes users feel as if they are descending down into the earth.
I wonder how well this effect would work for other instances of rising or descending. I imagine an application where you could descend from the clouds, a cloud passing in-front of content from time to time. It’s nice to point out small things like this.
@sliver37 – yeah, this game should be epic. :-)April 4, 2011 at 1:59 am #52378sliver37MemberThanks for the resources Mottie!
It’s fun playing around with this effect, can get some amazing results. For example using all three planes (foreground in addition to middle and back) you can create a fairly convincing 3D effect.
This would fit perfectly to those sites that are essentially one giant page, navigated by a smooth Jquery scroll targeting anchor tags. Especially if you add a subtle motion-blur. ;)
I almost wish I had of chosen this type of theme for my current project (class, not client) just to play around with it a little more.
August 23, 2011 at 3:29 pm #85498mcguiver178MemberI am using the jquery.scrolling-parallax.js does anyone knows how to make an element move horizontally when you scroll down vertically?
January 19, 2012 at 10:21 am #95007williammalo2MemberI have a very simple script to do this, no jquery! :
onscroll=function(){document.body.style.backgroundPosition=”0 “+(-(pageYOffset/2))+”px”;}
you need to have this:
background-attachment: fixed;
in your css also =)May 12, 2012 at 10:45 am #102728cheatindaveMemberWould it be possible to combine a vertical parallax with anchor scrolling to create something similar to this
http://activatedrinks.com/#/products
It’s a very Nice effect. nice site too
June 20, 2012 at 11:20 am #104665DrCLueMemberIf one’s event driven Javascript animations exhibit jerkiness, it’s often a good idea to de-couple the events from the animation routine itself.
Have the event handler simply store the values and do no actual animation itself
Have a separate interval pumped function read those values periodically and perform whatever animation.
Often the issue is that events occur too quickly to be properly serviced (event overrun) and frequently the difference between one event’s values and the next are not really worth servicing anyways.
If one has a situation where events come too fast AND the values may change a great deal, it’s still a good idea to decouple , but just have the interval function incrementally
walk towards the values which has a smoothing effect. -
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.