i create a function that move element by 1 px and repeat it with a specefic time with setInterval heres The Code :
var Elementt = document.querySelector('.h');
var left = 0;
var speed = 100;
var limit = 10;
setInterval(
function MoveByOnepixel() {
if (left > limit ){
}
else {
Elementt.style.left=left + 'px';
left++;
}
}
, speed);
The thing is when Left > limit is the setinterval stops or going to repeat without stop ?
If it repeat how do i stop it when the if statment is true ?
Aucun commentaire:
Enregistrer un commentaire