0

I've got a simple slider, and I want that users can click next, prev after for example 500ms after previous click. How to do this? Here's my code:

<script>
jQuery(document).ready(function(){
var ile = jQuery('.bestopis').length;
var licznik = 1;
$("#nast").click(function() {
    if(licznik == ile) {licznik=0};
    licznik ++;
    jQuery('.bestopis').fadeOut();
    jQuery("#bestopisy .bestopis:nth-child( " + licznik + " )").fadeIn();

});
$("#pop").click(function() {
    if(licznik == 1) {licznik = ile} else {licznik --};
    jQuery('.bestopis').fadeOut();
    jQuery("#bestopisy .bestopis:nth-child( " + licznik + " )").fadeIn();
});
});
</script>
4

2 回答 2

3

Use JavaScript setTimeout() function to re-enable your control 500ms after each click.

于 2013-10-13T20:13:48.930 回答
3

You could disable your control within the click wait for 500ms and reenable it, using jquery's delay() method.

For example if hiding it is acceptable,

jQuery('.yourControl').hide().delay(500).show();
于 2013-10-13T20:18:17.873 回答