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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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.

You Might Also Like