Can anyone tell me if it’s possible to disable keyboard input while an animation is playing through puzzles / code ?
I have a model which animates into an exploded view after a user clicks a button which also puts the browser into full screen mode. When exiting full screen mode the model collapses back together normally playing the animation in reverse.
There is a buggy effect if the user hits the escape key too quickly (exiting full screen mode) while the model is still animating.
I would like to lock all keyboard input until after the model is done animating. I tried to call these Javascript functions I found online thru the call JS function puzzle –
function disable() {
document.onkeydown = function () {
return false;
}
}
function enable() {
document.onkeydown = function () {
return true;
}
but it seems not to be doing anything.