Code in javascript Move circle by wheel.
hello, I have this code what I want is that when it reaches the end of the line it behaves like a wheel. The other thing is that when you go down to the second line and reach the limit of the if, when I want you to return in the opposite direction, you do it vehemently (quickly) I want it to be subtracting pixel by pixel. If anyone can give an opinion <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Index</title> <script> window.onload = function() { var pos = 0; var pos2=0; var pos3=0; //our box element var box = document.getElementById('mu'); var t = setInterval(move, 30); function move(){ if(pos>=1160){ pos2+=1; box.style.top= pos2+'px'; } else{ pos += 10; box.style.left= pos +'px'; } if(pos2>=110){ pos3-=1; box.style.left= pos3+'px'; } } }; </script>