If you can help, I need help with a timer in the plugin jquery cycle. So I need to create a timer that will go down from 20 seconds down to 19, 18, 17 ... over the cycle. Do you can help me.
Asked
Active
Viewed 60 times
-2
-
2Please show a code snippet of what you have tried or where you are having a problem. – Popo Feb 25 '14 at 17:51
2 Answers
0
You can try it like this. It counts down from 20 and when it reaches 0 it goes back to 20. If you don't want it to go back when it's zero, than replace "i = 20" with "return". http://codepen.io/anon/pen/kqhHB
$(document).ready(function() {
var i = 20;
setTimeout(count(i), 1000);
function count(i) {
$('#counter').html(i);
i--;
if(i < 0)
i = 20;
setTimeout(function(){ count(i); }, 1000);
}
});

Steven X
- 394
- 1
- 3
- 14
0
I know that for this timer over, but I knew to do that, in any case, thank you. I need a timer of 20 seconds but to go along with the slider now I'll explain exactly what I need. I have a slider that runs through the cycle plugin and it changes images every 20 seconds, but I need a timer to cycle because if not it can disrupt and confuse the picture changing with timer pocunu to change the image of the 2 or 3 secunde you reach 0 Do you have a way of doing this –