Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jump to slide #n

How can I interactively jump to a specific slide?

Programmatically, I can use Reveal.slide( indexh, indexv, indexf).

For instance, in S5, I can enter the slide number and then press Enter.

like image 245
Gerd Wagner Avatar asked Sep 05 '25 16:09

Gerd Wagner


1 Answers

There are succinct instructions for overriding the default keybindings in the Reveal.js Documentation. They say this:

Reveal.configure({
  keyboard: {
    13: 'next', // go to the next slide when the ENTER key is pressed
    27: function() {}, // do something custom when ESC is pressed
    32: null // don't do anything when SPACE is pressed (i.e. disable a reveal.js default binding)
  }
}); 

Keycodes for numbers 1-9 are 49-57 (0 is 48), so my read of the reveal.js event.keycode switch suggests you want something like:

Reveal.configure({
  keyboard: {
    56: slide( 8 ), 
  }
}); 

I'm not much of a jQuery whiz, but writing a function that notes any additional digits and waits for enter before jumping to slide n seems like a sort of advanced beginner level challenge (and a question that plenty of folks here could help you with). Question: what should happen if I type a non-number before I get to enter? What does 5qenter do?

like image 154
Amanda Avatar answered Sep 07 '25 16:09

Amanda