I have two buttons, the first should start in 3 seconds, the second in 1.5. For this purpose, I wrote a function
var start = setInterval(function(){ autoLoopSlider() }, 3000); function autoLoopSlider(button, time) { $(button).click(); setTimeout(autoLoopSlider, time); } autoLoopSlider(".button_1", 3000); autoLoopSlider(".button_2", 1500); function myStopFunction() { clearInterval(start); } But for some reason it does not work, tell me what I was wrong and how to fix the situation