From the course: Interactive Animations with CSS and JavaScript
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Auto-advance with JavaScript
From the course: Interactive Animations with CSS and JavaScript
Auto-advance with JavaScript
- [Instructor] So we've gotten to our second slide, and now we need to be able to advance our presentation without any user input. There are a few different ways we could do that. We could actually structure the whole thing using CSS animations and timeouts and that sorta stuff. It would get really convoluted in a hurry and difficult to organize. The simplest way, and the way I decided we're gonna go with this application is that we're gonna add the ability to put a timeout on the slide in the HTML, and then have some JavaScript that will advance the slide automatically. So let's go back to our code. So let's go back to our HTML file, and the way I would like to represent this, let's go ahead and duplicate our slide. So let's go take this second slide, and copy it, make a copy of it here, and now I have two slide twos, and I'm gonna add a new custom attribute now. To make the browser ignore this attribute, I'm gonna preface it with data hyphen, and then it can be anything we want, and…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Animation setup2m 27s
-
CSS @keyframes3m 21s
-
(Locked)
Easing2m 39s
-
(Locked)
Auto-advance with JavaScript2m 46s
-
(Locked)
Control animations with classes2m 27s
-
(Locked)
Animate visibility5m 7s
-
(Locked)
We need a montage1m 17s
-
(Locked)
Adding an animationend event handler5m 42s
-
(Locked)
Animating with CSS transitions5m 57s
-
(Locked)
Targeted animations using IDs3m 26s
-
(Locked)
Manipulating DOM with JavaScript3m 31s
-
(Locked)
Randomize slide displays7m 46s
-
(Locked)
Set timing for transitions3m 36s
-
(Locked)
-
-