Page Loader, once only play

Hi @Scott75,

Try replacing your code with this, republish and test:

<style>
.background-video {
  display:none;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.0/js.cookie.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function(event) { 
  const backgroundVideo = document.querySelector(".home-page");
  const scfLoader = document.querySelector('.background-video');

  const seenAnimation = Cookies.get('seenAnimation');
  if(!seenAnimation){
    scfLoader.style.display = "flex";
    setTimeout(()=>{
      backgroundVideo.style.display = "block";
    }, 6000); 
    Cookies.set('seenAnimation', 1, { expires: 1 });
  }
  else{
    scfLoader.style.visibility = "hidden";
    backgroundVideo.style.display = "block";
}
});
</script>

Let me know how you go!

1 Like