Skip to content

Commit 5c81e64

Browse files
authored
fix: solution index.html 2-ui/1-document/09../4...
1 parent 0685e3c commit 5c81e64

File tree

1 file changed

+3
-2
lines changed
  • 2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/solution.view

1 file changed

+3
-2
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626

2727

2828
<script>
29-
// ball.offsetWidth=0 before image loaded!
30-
// to fix: set width
29+
let ball = document.getElementById('ball')
30+
let field = document.getElementById('field')
31+
3132
ball.style.left = Math.round(field.clientWidth / 2 - ball.offsetWidth / 2) + 'px'
3233
ball.style.top = Math.round(field.clientHeight / 2 - ball.offsetHeight / 2) + 'px'
3334
</script>

0 commit comments

Comments
 (0)