Jump to content

Loading animation suddenly turns whole page black

Recommended Posts

Hi, I've used this code for years on my page and never had a problem with it. 

Suddenly my whole page is black and customer service figured it is because of the code...

When I removed the code my page worked again...but I would like to continue having the loading animation... Can anyone find the bug or has any tips? 

 

Thank you!!

This is the code I used: 

<!-- Loading Animation HTML -->

<div id="wm-loading-animation"><div class="loading-graphic"><img src=""></div></div>

<!-- Loading Animation Javascript -->

<script>

function getUrl(){let faviconLink = document.querySelector('link[rel="shortcut icon"]');let url = faviconLink.getAttribute('href');document.querySelector('#wm-loading-animation img').setAttribute('src', url);}getUrl();function hideAnimation(){document.querySelector("#wm-loading-animation").classList.add("hide-animation");}setTimeout(function(){ setTimeout(function(){ hideAnimation()}, 500); let checkLoad = setInterval(function(){if (document.readyState === "complete"){hideAnimation();clearInterval(checkLoad)}}, 100);}, 1500);

</script>

Link to comment
  • Replies 1
  • Views 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.