- 1
i want to make the ball move up and down once as this ball is the black in the eye so it will be like a facial emotion how can i
<div id='ball'></div> <script> var ball=document.getElementById('ball') var pos =50 function move(){ pos++ ball.style.top=pos+'px' if(pos<=110){ function back(){ clearInterval(t) pos-- ball.style.top=pos+'px' } var t=setInterval(move,10) } }
1 Respuesta
+ 3
- You never call move() function.
- There's is no call to back(), what is it supposed to do?? I think you meant "pos >= 110"
- Please copy the whole code in CodePlayground and share the link here. Your code is incomplete and we need to look at the CSS too.