From the course: CSS: Scrolling and Parallax

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Parallax scrolling with JavaScript

Parallax scrolling with JavaScript - CSS Tutorial

From the course: CSS: Scrolling and Parallax

Parallax scrolling with JavaScript

- [Instructor] Another useful measurement to be familiar with, is how far we have scrolled from the upper left corner of the window. And you can get this information with two properties. The first one is page y offset, and we run this usually on the window object that tells us how far from the top left of the window we are currently at. You can also get the page x offset, which tells you how far to the right we have scrolled. Now in really old browsers, and I'm talking about IE6 here, these were called something different. They were called scroll left and scroll top. And this made it a little bit difficult to code for these because you had to account for some browsers using one measurement system and other browsers using another. But unless you're trying to support IE6, I wouldn't worry about this. And to get a parallax effect, all we have to do is start scrolling things at different speeds. So let's take a look…

Contents