Jan 26, 2017

[Solution] Call Method Once Flip Is Done - jQuery-Flip

Question

 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 ?
Answere 
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);

$("#card").flip('toggle', ChangeWord); this worked out fine as this will happen only when i use it , but $("#card").on('flip:done', ChangeWord).flip('toggle'); will call the method every time it flips 

No comments:

JWT Token Decode Using Jquery

When it come to authentication we use many mechanism. Ones the user authenticated we must keep these details somewhere safe. So we can share...