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 - 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
-
-
-
-
-
Building your new monsters section9m 41s
-
(Locked)
Smooth scrolling on link clicks2m 48s
-
(Locked)
Request animation frame4m 22s
-
(Locked)
Adding classes when scrolling4m 3s
-
(Locked)
Removing the header cue when scrolling3m 50s
-
(Locked)
Parallax scrolling with JavaScript8m 35s
-
(Locked)
Determining when an object first appears7m 36s
-
(Locked)
Animating when objects enter the screen4m 15s
-
(Locked)
Randomizing the appearance5m 26s
-
-
-
-
-