Reputation: 1034
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>
Upvotes: 0
Views: 51
Reputation: 11671
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();
Upvotes: 3
Reputation: 2995
Use JavaScript setTimeout() function to re-enable your control 500ms after each click.
Upvotes: 3