Skip to content

Instantly share code, notes, and snippets.

@benfoxall
Created April 28, 2013 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benfoxall/5477620 to your computer and use it in GitHub Desktop.
Save benfoxall/5477620 to your computer and use it in GitHub Desktop.
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