0

How can I make the window scroll at a slower rate (horizontally and vertically) when triggered with the arrow keys? I've looked at some parallax demos, but they don't really do what I need. They mostly focus on background images, whereas I want my entire window and/or html body to slow down.

thanks!

1 Answers1

0

Try to fiddle with this code:

addEventListener('keydown', function(e){
    move = false;
    x = false;
    y = false;
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    switch(keycode){
        case 37:
            move = true;
            x = 'negative';
        break;
        case 38:
            move = true;
            y = 'negative'
        break;
        case 39:
            move = true;
            x = 'positive'
        break;
        case 40:
            move = true;
            y = 'positive'
        break;
    }
    if(move){
        animation.move(x,y);
    }
    return false;
})
odedta
  • 2,430
  • 4
  • 24
  • 51