jqueryhorizontal-scrollingjquery-scrollable

jQuery Horizontal automatic Scroller with right left keys


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!


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>