Jump to content

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

Stopping or resolving a dynamically created timeline

Recommended Posts

This timeline was created dynamically. But I can't stop the animation or make it resolve to the end the normal way (on an event—like a click). How can I do so?

See the Pen NJyJGv by gredesign (@gredesign) on CodePen

Link to comment
Share on other sites

I'm not sure I follow. You just want the timeline to do something on a click event? Here's a fork of your pen in which I just added a listener to the headlines div which will play/pause on click.


See the Pen vPVWOp by PointC (@PointC) on CodePen

Is that what you meant?


I see you asked something similar in this thread:

I assume this is all the same project? Hopefully that helps. Happy tweening.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Yes, this was a follow up to the same project. The last person who assisted didn't respond, so I decided to start a new thread. But anyhow, you have helped greatly. I see what was wrong now that I have looked at your addition. Somehow, this codepen snippet is actually part of a larger scale project. In the project, I realized that there was something a tad bit different than in the codepen example—the scope. The headline was created within a function—that was also within a function. My call to the timeline object was not reached because of the scope somehow. So I just resolved the headline on click from within the function. Hope that makes sense. I know it might be hard without seeing exactly what I am seeing, but I'm not able to post the larger project yet. Anyhow, thanks much for your help. Mission accomplished! :) 

Link to comment
Share on other sites

I think @Shaun Gorneau was just waiting on some info about your overall goal in the other thread.


But the main thing is that your issue is resolved. We're always glad to hear that. If you have any additional GSAP related questions, please let us know. Happy tweening.



  • Like 2
Link to comment
Share on other sites

Thanks Craig, yeah that post from Shaun wasn't appearing up until just now when you mentioned it. Not sure why I didn't see it before but I've checked over the past two days, but didn't see anything. Probably something I did wrong. Anyhow, thanks much for your help!

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