- [Instructor] Now we have our event handler in place.…Let's go ahead and write some code to advance the slide…to the next one.…Let's go back to our code.…And go into our click event.…Now plain JavaScript has a lotta great functions now…to help us maneuver through the DOM,…and the first thing I'm gonna do…is grab the current slide.…So current is going to be document.querySelector,…which lets you pass in tag name or class name or whatever…like you would use with jQuery or CSS,…and it will return one element.…So in this case,…the one element I wanna return is hp-slide.active,…and that is the current slide.…
And then I'm going to get the next element sibling.…So that's a great way to maneuver your way through the DOM.…I'm gonna say next equals current.nextElementSibling.…Now, if next is non-null,…so I'm gonna check this really quick, next.…And I know I could put in three equal signs and a null,…but I'm not going to do that, I'm sorry.…I started coding in 1988,…so this is just what you get.…If next, meaning there is something in there,…
Author
Released
9/4/2018- Storyboarding
- Creating a dynamic layout with flexbox
- Interactivity with JavaScript
- Navigating the DOM
- Adding animation
- Controlling animations with classes
- Manipulating SVG with JavaScript
- Applying CSS to SVG
Skill Level Intermediate
Duration
Views
Related Courses
-
CSS: Animation
with Val Head1h 59m Intermediate -
Learning App Building with Vanilla JavaScript
with Sasha Vodnik1h 44m Intermediate -
Angular: Animations
with Joseph Labrecque2h 19m Intermediate -
Web Portfolio Projects: Binding and Propagation
with Leigh Lawhon1h 9m Intermediate
-
Introduction
-
What you should know1m 4s
-
1. Building a Foundation
-
Storyboarding2m 14s
-
Animation strategies1m 43s
-
Set up your environment1m 8s
-
-
2. HTML Layout
-
HTML custom elements3m 15s
-
Center element CSS flexbox2m 26s
-
-
3. Interactivity with JavaScript
-
CSS selector specificity2m 37s
-
Navigating the DOM3m 19s
-
-
4. Adding Animation
-
Animation setup2m 27s
-
CSS @keyframes3m 21s
-
Easing2m 39s
-
Auto-advance with JavaScript2m 46s
-
Animate visibility5m 7s
-
We need a montage1m 17s
-
Randomize slide displays7m 46s
-
Set timing for transitions3m 36s
-
-
5. Working with SVG
-
The DOM is everything2m 43s
-
Applying CSS to SVG2m 21s
-
Fit and finish3m 7s
-
-
6. Conclusion
-
Next steps46s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Navigating the DOM