Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
ryanf

Passing $(this) into a Timeline

Recommended Posts

Hello, 

 

Is it possible to pass $(this) into a timeline so that I can access $(this) as well as the data attributes of an object?  

 

In the example pen I'd like to pass data attribute values from buttons into the timeline, ultimately to fade between two images - only after they have each fully loaded.  

 

Thanks.  

 

See the Pen GjkAyW by rfenik (@rfenik) on CodePen

Link to post
Share on other sites

Thanks for the demo. I don't think things are going to work the way you are hoping (unless I'm misunderstanding).

 

When a timeline is built it needs to know what the targets and values of all the tweens will be. I get the impression you hope to build one timeline and then have it play at different times with different targets and values as the value of $(this) changes based on what button is clicked.

 

I think for this situation you want to create a function that you pass $(this) into and then that function will create a new timeline with all the right values pertaining to the new image you want to display.

  • Like 1
Link to post
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.

×