From the course: reveal.js: Online Presentations

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Controlling your presentation with API events

Controlling your presentation with API events

From the course: reveal.js: Online Presentations

Start my 1-month free trial

Controlling your presentation with API events

Being able to control the flow of the presentation with JavaScript is somewhat useful. We learned how to do that in the last video. The real power of reveal.js comes when you learn how to execute commands based on the different events that get fired by the API. That means that you can learn to do things with reveal.js whenever something happens. Like with any other piece of JavaScript, in order to track events, you create event listeners. So I need to go all the way to the bottom of my slide. I definitely want to make sure that I do this after I call the reveal.js JavaScript Library. Now, I'm going to put this after the initialize function. So, it's going to go all the way to the end of my code and I'll do a script tag here. And inside that script tag, I want to add an event listener to the Reveal object. So Reveal.addEventListener. And first, I'm just going to look for the ready event. That's the event that happens whenever reveal.js is ready. So I'm going to call a function literal…

Contents