I created a flip book. How to add keyboard functions for turning pages??
Source code- https://github.com/Ananthavijay/News-Book
I created a flip book. How to add keyboard functions for turning pages??
Source code- https://github.com/Ananthavijay/News-Book
In Jquery, you can bind a keypress event to particular function like
$( "#target" ).keypress(function() {
console.log( "Handler for .keypress() called." );
});
if you want to bind the event to only a specific key for example left and right arrow keys;
$( "#target" ).keypress(function(event) {
if(event.which === 37 ){ //for left arrow key
console.log( "Handler for .keypress() called." );
}
});
Check out more key codes here
How to use keys "left", "right", "top", "bottom":
Detecting arrow key presses in JavaScript
You can use it with document.addEventListener('keydown', function(e){
// your code
})