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.
Smooth scrolling on link clicks - CSS Tutorial
From the course: CSS: Scrolling and Parallax
Smooth scrolling on link clicks
- [Narrator] Let's say you want to make the scrolling of your links a little bit smoother. So right now, when we click on this, it takes you to this section called meet the monsters, that's further down on the page, but it jumps to it immediately. And one way to fix this is by using a special property called scroll behavior. Now, as you can see, in caniuse.com scroll-behavior isn't well implemented in all browsers right now, but it's the sort of thing that is so easy to do than, I think you can use it right now, and then when newer websites accept this feature, it will be automatically added into them. So, let's take a look at how this works. So, the way that this works is you add a scroll behavior property, the default behavior is auto. So, you want to set that to smooth and you want to do that in the HTML element and tag it as important so that it overrides everything. So, let's see how that works. Switch back over…
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
-
-
-
-
-