Skip to content

Instantly share code, notes, and snippets.

@io41
Created July 27, 2014 15:09
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 io41/a6369184c8217bc26f6a to your computer and use it in GitHub Desktop.
Save io41/a6369184c8217bc26f6a to your computer and use it in GitHub Desktop.
history={'data': [
{
'o': 0, /* offset */
'h': 1, /* horizontal slide index */
'v': 0, /* vertical slide index */
},
{
'o': 120,
'h': 2,
'v': 0,
},
{
'o': 180,
'h': 3,
'v': 0,
},
{
'o': 300,
'h': 1,
'v': 0,
},
]}
var currentIndex = 2;
function getCurrentSlide(){
return history['data'][currentIndex];
}
function getNextSlide() {
return history['data'][currentIndex + 1];
}
function getStartOffSet(position) {
return 0
}
function setCurrentSlide(position) {
var state = getCurrentState();
var currentOffset = getStartOffset(position) + state['o'];
var nextOffset = getStartOffset(position) + getNextState()['o'];
if (position < currentOffset) {
currentIndex -= 1;
} else if (position > nextOffset) {
currentIndex += 1;
}
setSlide();
}
function setSlide() {
var slide = getCurrentSlide();
reveal.slide(slide['h'], slide['v']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment