-
-
Save lingo/0c7afab81c2c3c12de8ed16cbe7f8b1e to your computer and use it in GitHub Desktop.
Animated Knots key handling
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.onkeydown=checkArrowKeys; | |
document.addEventListener('keydown', checkArrowKeys); | |
function checkArrowKeys(e) { | |
var evt = e ? e : event; | |
var mykey = evt.keyCode; | |
if ((mykey == 37) && (prevKnot > 1)) { | |
showButtons(ButtonFadeDelay); | |
elemQ = document.getElementById('Prelim'); // Get Identity | |
elemQ.style.zIndex = -2; // Hide Labelled Image If Showing | |
nextImage(prevKnot, prevKnot - 1); // Previous Image | |
prevKnot--; // Decrease Count | |
reset(); | |
e.preventDefault(); // inserted e.preventDefault() here | |
} | |
// Right Arrow Key (Up) | |
if ((mykey == 39) && (prevKnot < MaxImages)) { | |
showButtons(ButtonFadeDelay); | |
elemQ = document.getElementById('Prelim'); // Get Identity | |
elemQ.style.zIndex = -2; // Hide Labelled Image If Showing | |
nextImage(prevKnot, prevKnot + 1); // Previous Image | |
prevKnot++; // Decrease Count | |
reset(); | |
e.preventDefault(); // inserted e.preventDefault() here | |
} | |
// Removed e.preventDefault() from here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment