Jump to content
Search Community

Motionpath plugin - return to start onComplete and play again on click?

fd_alistair test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

Hi there - is it possible to return my div to its initial start position once it has reached the end of the path?

I would image this could be done with onComplete: but not sure how to do it.

 

Basically I need the div to return to it's previous position so I can tell it to start again with a button press.

 

Any help would be appreciated.

 

Thanks

See the Pen ExEeyNN by fuzzyduck (@fuzzyduck) on CodePen

Link to comment
Share on other sites

  • Solution

You can use .restart() for that if you want it to happen on click

 

See the Pen BarOzpM?editors=1011 by mvaneijgen (@mvaneijgen) on CodePen

 

If you want it to happen as soon as it is done, indeed the code @elegantseagulls suggests works. You had some functions in your code that didn't do anything, so I connected them to each other. Hopefully there is something in their that helps you.

 

See the Pen qBoMNrX?editors=1011 by mvaneijgen (@mvaneijgen) on CodePen

 

 

  • Like 1
Link to comment
Share on other sites

2 hours ago, mvaneijgen said:

You can use .restart() for that if you want it to happen on click

 

 

 

 

If you want it to happen as soon as it is done, indeed the code @elegantseagulls suggests works. You had some functions in your code that didn't do anything, so I connected them to each other. Hopefully there is something in their that helps you.

 

 

 

Many thanks, that's ace!

 

 

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