Bummer! You must be logged in to access this page.

Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Parallax Effect

So I am working on a website for my marketing company, and I am attempting to use parallax quite a lot (mostly on div backgrounds). I have been coding for awhile and I feel comfortable with most tasks, but I haven't found a solid method for this effect. Is there a good tutorial somewhere on this topic? The closest thing I found got me somewhat there, but when I apply it, it's jittery and seems bulky.

2 Answers

Joel,

I used these two YouTube tutorials.

Javascript Parallax Effect Explained

Javascript Parallax Details Cross Browser and Optimizations

The tutorials cover JavaScript optimization. I made this change for Microsoft Edge.

 //top = thingBeingScrolled.scrollTop;
                if (window.navigator.userAgent.indexOf("Edge") === -1) {
                    top = document.documentElement.scrollTop;
                }
                else {
                     top = document.body.scrollTop;
                }

Thank you!

http://pixelcog.github.io/parallax.js/

You can try this jquery library.

Thanks for your response!