Jump to content

Create page loading/page transition effect

Go to solution Solved by tuanphan,

Recommended Posts

@tuanphan Hi, that one looks nice too and I've seen websites do it, but it seems to only be like a pre loader for the home page and not the rest of the website, so I kinda still prefer a fade out/fade in effect like in the tutorial. But this one also looks good and if it's not too complicated to set up I want to give it a try as well. Thank you

Link to comment

Have you tried copy code in video yet? I see that code is for 7.1 version.

Code I sent, I set for one page only, however if you add code to Site wide Code Injection, it should load on all pages

You can add code to Website Tools (under Not Linked) > Code Injection > Footer. Replace example lottie file with your file. Or if you want to use image/text only, let me know, I will adjust the code

<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>

<div class="splash-wrapper">
  <lottie-player src="https://lottie.host/7134761f-9be6-42da-bb65-6ff81185617b/uEgxToPhd9.json"  background="transparent"  speed="1"  style="width: 275px; height: 275;"  loop  autoplay></lottie-player>
</div>
<style>
.splash-wrapper {
  position:fixed;
  z-index:9999;
  background-color: #000000;
  height:100vh;
  width:100vw;
  display:flex;
  flex-flow: column nowrap;
  justify-content:center;
  align-items:center;
  animation-name: slideOut;
  animation-fill-mode: forwards;
  animation-duration:.65s;
  animation-delay: 5s;
}
@keyframes slideOut {
  from {margin-left: 0vw;}
  to {margin-left: -100vw;}
}
</style>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
On 11/26/2023 at 4:26 AM, tuanphan said:

Replace example lottie file with your file

Hi, sorry I did not fully understand your instruction. What kind of file should I use? Can it just be the logo of our company? And it looks like I need to upload it somewhere in order to get a link for the code?

Link to comment
On 11/28/2023 at 7:53 PM, KhanhLy174 said:

 

Hi, I do want to have my company's logo on a white background. Attached is the logo.

Logo TANIQ transparent.png

Use this code to Website Tools > Code Injection > Footer

<!-- Container for the splash screen with a specified ID -->
<div class="splash-wrapper" id="loader-container">
    <img src="https://content.invisioncic.com/p289038/monthly_2023_11/LogoTANIQtransparent.thumb.png.0c1808606ac76767e354e33194011587.png"/>
</div>

<style>
  div#loader-container img {
    max-width:500px;
}
  /* Loader animation styles */
  .splash-wrapper {
    display: none; /* Initially hidden */
    position: fixed;
    z-index: 9999;
    background-color: white;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-flow: column nowrap;
    justify-content: center;
    align-items: center;
    animation-name: slideOut;
    animation-fill-mode: forwards;
    animation-duration: 0.65s;
    animation-delay: 5s;
    top: 0;
  }

  @keyframes slideOut {
    from {
      margin-left: 0vw;
    }
    to {
      margin-left: -100vw;
    }
  }
  @media screen and (max-width:767px) {
  div#loader-container {
    background-size: cover;
}
div#loader-container img {
    max-width: 300px;
}
  }
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
    setTimeout(function(){
        $('.splash-wrapper img').fadeIn(500);
    }, 3000);
});
</script>

See demo: https://tuanphan3.squarespace.com/1images-loading?noredirect

pass: abc

Edited by tuanphan

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • Solution
On 11/30/2023 at 11:21 AM, tuanphan said:

Use this code to Website Tools > Code Injection > Footer

<!-- Container for the splash screen with a specified ID -->
<div class="splash-wrapper" id="loader-container">
    <img src="https://content.invisioncic.com/p289038/monthly_2023_11/LogoTANIQtransparent.thumb.png.0c1808606ac76767e354e33194011587.png"/>
</div>

<style>
  div#loader-container img {
    max-width:500px;
}
  /* Loader animation styles */
  .splash-wrapper {
    display: none; /* Initially hidden */
    position: fixed;
    z-index: 9999;
    background-color: white;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-flow: column nowrap;
    justify-content: center;
    align-items: center;
    animation-name: slideOut;
    animation-fill-mode: forwards;
    animation-duration: 0.65s;
    animation-delay: 5s;
    top: 0;
  }

  @keyframes slideOut {
    from {
      margin-left: 0vw;
    }
    to {
      margin-left: -100vw;
    }
  }
  @media screen and (max-width:767px) {
  div#loader-container {
    background-size: cover;
}
div#loader-container img {
    max-width: 300px;
}
  }
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
    setTimeout(function(){
        $('.splash-wrapper img').fadeIn(500);
    }, 3000);
});
</script>

See demo: https://tuanphan3.squarespace.com/1images-loading?noredirect

pass: abc

updated code, I added some attributes, you try adding it again, if it still doesn't work, try moving the code to Code Injection > Header,

if it still doesn't work, you can keep the code, I can check again easier

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
19 hours ago, tuanphan said:
<!-- Container for the splash screen with a specified ID -->
<div class="splash-wrapper" id="loader-container">
    <img src="https://content.invisioncic.com/p289038/monthly_2023_11/LogoTANIQtransparent.thumb.png.0c1808606ac76767e354e33194011587.png"/>
</div>

<style>
  div#loader-container img {
    max-width:500px;
}
  /* Loader animation styles */
  .splash-wrapper {
    display: none; /* Initially hidden */
    position: fixed;
    z-index: 9999;
    background-color: white;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-flow: column nowrap;
    justify-content: center;
    align-items: center;
    animation-name: slideOut;
    animation-fill-mode: forwards;
    animation-duration: 0.65s;
    animation-delay: 5s;
    top: 0;
  }

  @keyframes slideOut {
    from {
      margin-left: 0vw;
    }
    to {
      margin-left: -100vw;
    }
  }
  @media screen and (max-width:767px) {
  div#loader-container {
    background-size: cover;
}
div#loader-container img {
    max-width: 300px;
}
  }
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
    setTimeout(function(){
        $('.splash-wrapper img').fadeIn(500);
    }, 3000);
});
</script>

This code works. Thank you so much.

Link to comment
42 minutes ago, KhanhLy174 said:

Actually, I just realized that the page loader applies to all pages on the website. Can I only apply this to the Home page?

You can remove code from Site wide Code Injection to Homepage Header Code Injection

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 2 months later...
On 2/9/2024 at 4:02 PM, Jsu said:

Hi, 

I am trying to create the same effect, could you tell me what preparation I need to do to create the animated logo and upload it as a link? I m not a coder so I need a bit of guidance. Thank you!

If you have a static image logo, I can give you new code.

This is an example with logo image file

https://tuanphan3.squarespace.com/1images-loading?noredirect

pass: abc

Edited by tuanphan

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 2 weeks later...

Piggy backing off this, how would you get the image to fade in and out as the effect rather than a slide screen? Below is the code. Or if possible having it slide from the right off screen to center, then center to left off screen.

<!-- Container for the splash screen with a specified ID -->
<div class="splash-wrapper" id="loader-container">
    <img src="https://images.squarespace-cdn.com/content/v1/649b429616032536f15d518f/2ae3c744-e26c-4b79-8550-0b9dee0ae285/cropped-Newport-Circle-Black-NoBckGrnd-2022.png?format=1500w"/>
</div>

<style>
  div#loader-container img {
    max-width:500px;
}
  /* Loader animation styles */
  .splash-wrapper {
    display: none; /* Initially hidden */
    position: fixed;
    z-index: 9999;
    background-color: white;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-flow: column nowrap;
    justify-content: center;
    align-items: center;
    animation-name: slideOut;
    animation-fill-mode: forwards;
    animation-duration: 0.65s;
    animation-delay: 1.5s;
    top: 0;
  }

  @keyframes slideOut {
    from {
      margin-left: 0vw;
    }
    to {
      margin-left: -100vw;
    }
  }
  @media screen and (max-width:767px) {
  div#loader-container {
    background-size: cover;
}
div#loader-container img {
    max-width: 300px;
}
  }
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
    setTimeout(function(){
        $('.splash-wrapper img').fadeIn(300);
    }, 2000);
});
</script>

Edited by Cdonn
Link to comment
On 2/23/2024 at 4:12 AM, Cdonn said:

Piggy backing off this, how would you get the image to fade in and out as the effect rather than a slide screen? Below is the code. Or if possible having it slide from the right off screen to center, then center to left off screen.

<!-- Container for the splash screen with a specified ID -->
<div class="splash-wrapper" id="loader-container">
    <img src="https://images.squarespace-cdn.com/content/v1/649b429616032536f15d518f/2ae3c744-e26c-4b79-8550-0b9dee0ae285/cropped-Newport-Circle-Black-NoBckGrnd-2022.png?format=1500w"/>
</div>

<style>
  div#loader-container img {
    max-width:500px;
}
  /* Loader animation styles */
  .splash-wrapper {
    display: none; /* Initially hidden */
    position: fixed;
    z-index: 9999;
    background-color: white;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-flow: column nowrap;
    justify-content: center;
    align-items: center;
    animation-name: slideOut;
    animation-fill-mode: forwards;
    animation-duration: 0.65s;
    animation-delay: 1.5s;
    top: 0;
  }

  @keyframes slideOut {
    from {
      margin-left: 0vw;
    }
    to {
      margin-left: -100vw;
    }
  }
  @media screen and (max-width:767px) {
  div#loader-container {
    background-size: cover;
}
div#loader-container img {
    max-width: 300px;
}
  }
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
    setTimeout(function(){
        $('.splash-wrapper img').fadeIn(300);
    }, 2000);
});
</script>

Can you share link to page where you added this code?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 2 weeks later...

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.