Last active
December 21, 2015 13:39
-
-
Save tedrick/109eb51d73932aeb3f47 to your computer and use it in GitHub Desktop.
Basic keyboard navigation for Story Map Series (place in index.html's custom JS section in the tpl-ready handler)
This file contains 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
$(document).keyup(function(e){ | |
//Right > forward | |
if (e.which === 39 || e.which === 34) { | |
var currentIndex = app.data.getCurrentEntryIndex(); | |
if (currentIndex < app.data.getStoryLength() -1) { | |
topic.publish("story-navigate-entry", currentIndex + 1); | |
console.log('right'); | |
console.log(currentIndex); | |
} | |
} | |
//Left > backward | |
else if (e.which === 37 || e.which === 33) { | |
var currentIndex = app.data.getCurrentEntryIndex() | |
if (currentIndex > 0) { | |
topic.publish("story-navigate-entry", currentIndex - 1); | |
console.log('left'); | |
console.log(currentIndex); | |
} | |
} | |
console.log(e.which); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@acarroll51 - I mentioned this last week- basic keyboard navigation for the Story Map Series