+ 1

How can I do s.th that when r<5 onclick=false

https://code.sololearn.com/WBM1RRR6aoJg/?ref=app

19th Apr 2018, 3:11 PM
Sina
Sina - avatar
2 Answers
0
I'd add this code to ensure the callback only adds a single setInterval. var c = 0; var x; var r = 328; function right(){ x = document.getElementById("p") r=r-5 p.style.right = r + "px"; if(r<5) { clearInterval(b); c = 0; } } var b; function rightd(){ if (c == 0) { b = setInterval(right,100); } c = c + 1; }
19th Apr 2018, 10:04 PM
Emma
0
I want it when r<5 and user clicked on the button it doesn't work(it does't move)
20th Apr 2018, 8:21 PM
Sina
Sina - avatar