Created
March 11, 2015 11:54
-
-
Save mrichar1/530776a75da951fc71a0 to your computer and use it in GitHub Desktop.
reveal.js - hotkey to jump to/from a named slide
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reveal.initialize({ | |
keyboard: { | |
// '0' key will jump between current slide and slide-X | |
48: function() {jumpSlide()}, | |
} | |
}); | |
function jumpSlide() { | |
// The id of the slide you wish to jump to/from | |
target = "slide-X"; | |
slide = Reveal.getCurrentSlide(); | |
// If we're on the target slide, jump to original slide, if there was one | |
if (slide.id == target) { | |
Reveal.slide(orig['h'], orig['v']); | |
} | |
else { | |
// 'Save' the current slide's index to jump back to later | |
orig = Reveal.getIndices(); | |
// Jump to the target slide | |
jump = Reveal.getIndices(document.getElementById(target)); | |
Reveal.slide(jump['h'], jump['v']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment