I have a slide show on my site, but there is a problem with.
Here is my JS:
var size_ini = 1;
$(document).ready(function() {
setInterval('$("#next").click()',10000)
$("#next").click(function() {
if(size_ini < 3);
size_ini++;
else
size_ini = 1
$(".sample").hide();
$("#id" + size_ini).show();
$(".comment" + size_ini).show();
$(".comment_description" + size_ini).show();
});
$("#prev").click(function() {
if(size_ini > 1)
size_ini--;
else
size_ini = 3;
$(".sample").hide();
$("#id" + size_ini).show();
$(".comment" + size_ini).show();
$(".comment_description" + size_ini).show();
});
});
As you can see, I have a timer lasting 10 seconds. for slides. I have the previous and next button. Therefore, when I pressed one of the buttons, the timer should stop and start again. I tried "clearInterval", but this does not work.
Can anyone tell how this works.
Here is the FIDDLE .
source
share