Jump to content
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

Share this post


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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.