Jump to content

Can you turn off lazy loading so that everything appears on the page once it's loaded?

Recommended Posts

Posted (edited)
On 8/2/2022 at 11:44 PM, tuanphan said:

Try adding this to Design > Custom CSS

body[class*="type-blog"] #page * {
    transform: unset !important;
    opacity: 1 !important;
    transition-delay: unset !important;
    transition: unset !important;
}

 

Just from doing my own test with this CSS, everything still loads in parts until the entire page appears which is what is hurting CLS in Google.

So far I've found that the best solution is by creating a loading screen like the one below, but I'm not positive yet if this is what will satisfy Google CLS. From what I understand google needs to show that everything on the page isn't moving around as the user is watching it load.

 

<div id="wm-loading-animation">
  <div class="loading-graphic">
    <img src="https://images.squarespace-cdn.com/content/v1/6226f62738f4f73d2b353e79/f7f0d350-1a95-4178-8aa6-39c05a527ef9/noahawaii.png?format=1000w">
  </div>
</div>
<script>
  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)
      }
    }, 1);
  }, 1000);
</script>
<style>
#wm-loading-animation img{
  height:150px;
  width:auto;
}
#wm-loading-animation{
  height:100vh;
  width:100vw;
  background:#fff;
  position:fixed;
  z-index: 99999999999999999999999999999999999;

  display:flex;
  align-items:center;
  justify-content:center;
}

.wm-slider-container .dots-container{
  left: unset !important;
  transform: unset !important;
  right: 3vw
}

@keyframes pulse{
  0%{ transform:scale(1.1)} 
  50%{ transform:scale(0.9)} 
  100%{ transform:scale(1.1)} 
}

.loading-graphic{
  animation: pulse 3s ease-in-out infinite;
}

#wm-loading-animation.hide-animation{
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s 1s,
    opacity 1s linear; /*Hide this element after load*/
}
</style>

Edited by noahawaii

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.