Skip to content

Commit 85ec4f3

Browse files
authored
fix: 2-ui/1.../09.../4.../ball-half/index.html
1 parent cbb1ad5 commit 85ec4f3

File tree

1 file changed

+2
-2
lines changed
  • 2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/ball-half

1 file changed

+2
-2
lines changed

2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/ball-half/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
// 有值则进行计算,没值则在 100ms 后再次获取并判断,时间长短可自行设定
3434
const updateBallPosition = () => {
3535
if (field.clientWidth && ball.offsetWidth) {
36-
ball.style.left = Math.round(field.clientWidth / 2 - ball.offsetWidth / 2) + 'px';
37-
ball.style.top = Math.round(field.clientHeight / 2 - ball.offsetHeight / 2) + 'px';
36+
ball.style.left = Math.round(field.clientWidth / 2) + 'px';
37+
ball.style.top = Math.round(field.clientHeight / 2) + 'px';
3838
} else {
3939
setTimeout(updateBallPosition, 100);
4040
}

0 commit comments

Comments
 (0)