안녕하세요, 제가 screeen (500x500)에서 이동할 때 theBox를 중지해야합니다. anyhelp하는 방법을 모릅니다?theBox를 중지해야합니다
<style>
#box { position: absolute; top: 0; left: 0; background-color: green; }
</style>
<script>
onload = function() {
var theBox = document.getElementById("box");
function animate() {
if ("theBox")
theBox.style.left = (theBox.offsetLeft+5)+"px";
theBox.style.top = (theBox.offsetTop+5)+"px";
}
setInterval(animate,100);
}
</script>
</head>
<body>
<div id="box">The box</div>
</body>
이 더 나은 && 대신에 사용 발견 && –
@MrCode를 바운싱하고 싶습니다. –