0
for reasons of study and knowledge, how could I clear a setInterval and then according to some event I can continue its execution again.
'use strict';
var imgAtual = 0;
var arrImg = ['images/relatorio.jpg', 'images/clp.jpg', 'images/estudo-viabilidade.jpg', 'images/padrao.jpg'];
function mudarImagem(){
var imgElm = document.querySelector('.img-slide');
if(imgAtual < arrImg.length){
imgElm.setAttribute('src',arrImg[imgAtual]);
imgAtual++;
console.log(imgAtual);
}else{
imgAtual = 0;
imgElm.setAttribute('src',arrImg[imgAtual]);
imgAtual++;
}
imgElm.addEventListener('click',function(){
clearInterval(mudando);
})
}
var mudando = setInterval(function(){
mudarImagem();
},1000);
@Marconi I want to return with the execution of setInterval after I have already paralyzed her with a clearInterval.
– Michael Alves