+ 3
How can I do this animation infinitive?
I mean, how can this box go left from right, when it is full max, to infinitive. Code: https://code.sololearn.com/WO5kU8e1v2Vw/#html
2 Respuestas
+ 3
Check if the box is > than the container width, if it is reset the position back to the start
+ 2
UPDATE:
I done this!
@Ole113
How can I (command) overwrite in else if position I mean position of the box to 0 again from 1888?
Here:
window.onload = function() {
var pos = 0;
var box = document.getElementById('interactive');
var t = setInterval(move, 10);
function move() {
if(pos < 1888) {
pos += 1;
box.style.left = pos+'px';
}
else if(pos === 1888) {
pos -= 1888;
}
else {
?
}
}
}