Jump to content
Search Community

Link to timeline position/label from another page

AJT test
Moderator Tag

Recommended Posts

Hi there, 

 

Wondering if anyone can help with this one, as haven't been able to find anything in the forums just yet. 

 

I want to link to a position in my timeline when I navigate back to the homepage from another page on the site. 

 

Currently have an intro animation on the site, that we'd like to skip when clicking on the home button from the site navigation on other pages.

 

Is there a way to add an anchor link to the href that can seek a position?

 

Cheers

AJ

Link to comment
Share on other sites

Hey AJT, welcome!

 

There are several ways to determine if a user has been to a page before. If you're loading pages normally (a whole new page every anchor click), cookies like mikel suggested or a query parameter would be the ways to go. If you're loading new content without a full page refresh as is relatively common these days, you could just set a state variable in your JS and use that.

 

In terms of the GSAP side of how to skip an animation depending on that information, there's a few options as well. You could have two separate timelines, one for the "intro" animations and one for the second part. The intro animation could call the second animation in it's onComplete. Or you could use the conditional logic to chain them or not from the start. Alternatively you could use one timeline for both parts, include a label in between the two, and tweenFrom that label.

 

Whatever you decide, it'd probably be best for you to give it a shot and then post again if you get stuck on something :) 

 

Happy tweening!

  • Like 2
Link to comment
Share on other sites

Hi Mikel and Zach, 

 

Thanks so much for taking the time to reply. First time I needed to post on the forums and your answers were both extremely helpful and provided the answers.

 

To help simplify the cookies I used this js library https://github.com/js-cookie/js-cookie, which made it a bit simpler to set and get the cookies.

 

From there, run a jquery check on startup to see if the cookies set, and if so seek the part of the master timeline required. 

 

Again, really appreciate the help, and the warm welcome to the community.

Cheers

Adam

  • 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...