mirror of
https://github.com/Ellpeck/TinyLifeWeb.git
synced 2024-11-26 12:58:34 +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,6 +35,8 @@
|
||||||
|
|
||||||
let background = $(".top");
|
let background = $(".top");
|
||||||
background.css("background-position", `${x}% ${y}%`);
|
background.css("background-position", `${x}% ${y}%`);
|
||||||
|
|
||||||
|
$(window).on("load", function () {
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
x += addX;
|
x += addX;
|
||||||
y += addY;
|
y += addY;
|
||||||
|
@ -44,4 +46,5 @@
|
||||||
addY *= -1;
|
addY *= -1;
|
||||||
background.css("background-position", `${x}% ${y}%`);
|
background.css("background-position", `${x}% ${y}%`);
|
||||||
}, 30);
|
}, 30);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
Loading…
Reference in a new issue