This code does not work here (for a slide banner):
function slideBannerAnimation(numbersOfSlides){ var currentSlide = 0; var clicked = false; $("#slideBanner").css({overflow:"hidden", height:"432px"}); $(".control").css("display", "block") .click(function(){ currentSlide = ($(this).attr("id") == "toPrevious")?currentSlide-1:currentSlide+1; clicked = true; if(currentSlide < 0) currentSlide = numbersOfSlides; if(currentSlide > numbersOfSlides) currentSlide = 0; $("#slideContainer").animate({ "margin-left":$(document).width()*(-currentSlide) }, 800); }); if(!clicked){//С этого момента не работает. Всё остальное, как по часам setInterval(function(){ $("#slideContainer").animate({ "margin-left":$(document).width()*(-currentSlide) }); }, 3000); } } Tell me how to make the animation trigger at intervals if the user has not clicked on the control buttons.