I am trying to make a site scroll up when the left arrow is pressed, and down when the right arrow is pressed.
I am trying this:
$("body").keydown(function(e){
console.log( e.which );
// left arrow
if ((e.keyCode || e.which) == 37)
{
e.keyCode = 38;
e.which = 38;
$("body").trigger( e );
}
// right arrow
if ((e.keyCode || e.which) == 39)
{
e.keyCode = 40;
e.which = 40;
$("body").trigger( e );
}
});
But is not working fine, can you point me in the right direction?