mirror of
https://github.com/Ellpeck/TinyLifeWeb.git
synced 2024-11-22 19:28:35 +01:00
only start moving the background once the page has fully loaded
This commit is contained in:
parent
0defd1da5a
commit
f5c675ace4
1 changed files with 12 additions and 9 deletions
|
@ -35,13 +35,16 @@
|
||||||
|
|
||||||
let background = $(".top");
|
let background = $(".top");
|
||||||
background.css("background-position", `${x}% ${y}%`);
|
background.css("background-position", `${x}% ${y}%`);
|
||||||
setInterval(function () {
|
|
||||||
x += addX;
|
$(window).on("load", function () {
|
||||||
y += addY;
|
setInterval(function () {
|
||||||
if (x < 0 || x > 100)
|
x += addX;
|
||||||
addX *= -1;
|
y += addY;
|
||||||
if (y < 0 || y > 100)
|
if (x < 0 || x > 100)
|
||||||
addY *= -1;
|
addX *= -1;
|
||||||
background.css("background-position", `${x}% ${y}%`);
|
if (y < 0 || y > 100)
|
||||||
}, 30);
|
addY *= -1;
|
||||||
|
background.css("background-position", `${x}% ${y}%`);
|
||||||
|
}, 30);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
Loading…
Reference in a new issue