We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5c81e64 commit 19769acCopy full SHA for 19769ac
2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/solution.view/index.html
@@ -29,8 +29,10 @@
29
let ball = document.getElementById('ball')
30
let field = document.getElementById('field')
31
32
- ball.style.left = Math.round(field.clientWidth / 2 - ball.offsetWidth / 2) + 'px'
33
- ball.style.top = Math.round(field.clientHeight / 2 - ball.offsetHeight / 2) + 'px'
+ window.onload = function() {
+ ball.style.left = Math.round(field.clientWidth / 2 - ball.offsetWidth / 2) + 'px';
34
+ ball.style.top = Math.round(field.clientHeight / 2 - ball.offsetHeight / 2) + 'px';
35
+ };
36
</script>
37
38
0 commit comments