Search Results

Search found 1 results on 1 pages for 'jaybuz'.

Page 1/1 | 1 

  • Slider with keypress control bugs when keys pressed to quickly.

    - by Jaybuz
    Hello, I've made a slider that uses the left and right arrow keys to move the slide but when pressed to quickly it will bug a little and I was wondering if it's possible to limit the amount of presses in say a second. You can see it here: {link} $('#slider-nav div').click(function() { $('#slider-nav div').removeClass('selected').addClass(''); $('#slider-nav div:eq('+($.jcarousel.intval($(this).text())-1)+')').addClass('selected'); }) // Allow left and right keys to control slider $(document.documentElement).keypress(function(e) { var code = (e.keyCode ? e.keyCode : e.which); var direction = null; // handle cursor keys if (code == 37) { // left key direction = 'prev'; } else if (code == 39) { // right key direction = 'next'; } if (direction != null) { $('#slider-nav div.selected')[direction]().click(); } });

    Read the article

1