Skip to content

Instantly share code, notes, and snippets.

@benfoxall
Created April 28, 2013 17:28
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Snippet to keep reveal.js windows in sync using storage events.
// only for top level windows
if(window.top === window){
// store the new slide index
Reveal.addEventListener('slidechanged', function(e) {
var send = e.indexh + ',' + e.indexv;
localStorage.setItem('rslide',send);
});
// restore
window.addEventListener("storage", function(e){
if(e.key == 'rslide'){
var vals = e.newValue.split(',').map(parseFloat);
Reveal.slide(vals[0],vals[1]);
}
}, false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment