Question

I have used the following jquery to have horizontal scrolling of the content with MOUSE SCROLLER :

http://www.htmldrive.net/items/show/966/jQuery-Horizontal-automatic-Scrollbars-with-mouse

Now I want to carry out this horizontal scrolling with the right and left keys of the keyboard but I can't figure out as to how to do this!

Was it helpful?

Solution

Maybe you can "fake" the click on the two buttons like this :

<script>
    $('body').keydown(function(e) {
        if(e.keyCode == 37) { // left key down
            $('#left_scroll').click();
        } else if(e.keyCode == 39) { // right key down
            $('#right_scroll').click();
        }
    });
</script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top