18th Apr 2018, 6:14 PM
Sina
Sina - avatar
6 Respuestas
+ 2
here is working code var x; var r = 328; function right(){ x = document.getElementById("p") r=r-5 x.style.right = r + "px"; if(r<=0) { clearInterval(b) } } var b; function rightd(){ b = setInterval(right,100) }
18th Apr 2018, 7:33 PM
Damyan Petkov
Damyan Petkov - avatar
+ 1
becuase 'width' of the element is 300 something and you compare it to the 'right' of the smiley which get smaller every time. think about it, the condition cannot be true in that case because roght will not catch up to width
18th Apr 2018, 7:16 PM
Paul
+ 1
in the 7th line instead of div width put 0 + px and see magic happend
18th Apr 2018, 7:18 PM
Paul
0
Can you edit it plz??
18th Apr 2018, 7:17 PM
Sina
Sina - avatar
0
see my code nothing happend
18th Apr 2018, 7:25 PM
Sina
Sina - avatar
0
Oh thanks
18th Apr 2018, 8:22 PM
Sina
Sina - avatar