diff --git a/scripts/static.js b/scripts/static.js index b5c3c11..a4df707 100644 --- a/scripts/static.js +++ b/scripts/static.js @@ -19,6 +19,16 @@ function fetchData(url) { }); } +function checkWindowSize() { + if ($(window).height() > 446) { + $(".loading-page").css("opacity", 0); + $(".container").css("opacity", 1); + } else { + $(".loading-page").css("opacity", 1); + $(".container").css("opacity", 0); + } +} + let AppendData = 0 function RequestLoadPage() { fetchData('https://api.lanyard.rest/v1/users/543465365057961986').then(user => { @@ -61,6 +71,15 @@ function RequestLoadPage() { $(".container").css("opacity", 0); }, 250); }); + + $(window).on('offline', function () { + setTimeout(() => { + $(".loading-page").css("opacity", 1); + $(".container").css("opacity", 0); + }, 250); + }); + + window.onresize = checkWindowSize; } $(".loading-page").css("opacity", 0); @@ -72,5 +91,6 @@ function RequestLoadPage() { } $(document).ready(function() { - RequestLoadPage() + RequestLoadPage(); + });