Call Method Once Flip Is Done - jQuery-Flip

Call Method Once Flip Is Done - jQuery-Flip

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 ?

3

1 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.