Call Method Once Flip Is Done - jQuery-Flip
Mia Lopez
I am using a Flip Plugin
I have been trying to call a method once the flip is done/completed, but the method is getting called even before the flip is done.completed.
$("#card").flip('toggle');
$("#card").on("done", ChangeWord());Let me know where i am going wrong ?
31 Answer
Your answer is in the link you posted in the question under the 'Events' heading. Specifically, the flip:done event. Also note that you need to pass the reference of the ChangeWord() function to the event handler, not its return value. Try this:
$("#card").on('flip:done', ChangeWord).flip('toggle');Alternatively the flip() method accepts a callback function to be executed when the animation completes:
$("#card").flip('toggle', ChangeWord); 2