The code below is effective in preventing browser defaults by firing in Chrome and Safari. For some reasons, however, my code does not run even after pressing the arrow key in Firefox
$ (window) .keydown (function (e) {switch (e.which) {case 39: // right arrow key e.preventDefault (); $ ('body') ScrollLeft (scrollNow + z (10); break; Case 37: // left arrow key e.preventDefault (); $ ('body' ScrollLeft (scrollNow - z (10)); break;}}); I tried return false; Instead of e.preventDefault (); Also, but I have no effect in e.preventDefault (); Also tried to put after the scrollLeft line, but is it not working either any ideas?
try this -
code = e.keyCode || E.which; Switch (code) {
No comments:
Post a Comment