Jump to content
Search Community

Staggering webpage on page load?

Vincentccw test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I want to create an effect that it will load my web page gradually from 1 div to another once the page load.

I have applied staggerFrom() method so that it can create the desired effect that will load from the header follow by content and extend till footer.

 

But my problem is that when I put it on live server, the webpage will load the animation even though the content isn't fully loaded, resulting in freezing the animation for few seconds....

 

Is there any solution for this?

Link to comment
Share on other sites

Are you saying that the animation starts playing and then freezes in the middle? Or are you seeing all the content appear before the animation starts playing?

 

Hard to offer a solution without seeing some code. A very basic codepen or jsfiddle demo would really help.

 

Although I'm not really sure what's happening, I'd suggest that you use some javascript to detect that your page is fully loaded (html and images) before starting your animation.

window.onload=pageLoaded;

function pageLoaded() {
   //code to start you animation
}

https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers.onload

 

if you are using jQuery, you can also use $(window).load()

http://api.jquery.com/load-event/

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...