Create a gist now

Instantly share code, notes, and snippets.

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