Closed Ryan-321 closed 9 years ago
you could activate the event listener for compareFlipped
after you do $( this ).addClass( "flip" );
tried it: $(".pieceContainer" ).on( "click" , function() { $( this ).addClass( "flip" ); $(".pieceContainer" ).on( "click" , compareFlipped ); });
and $(".pieceContainer" ).on( "click" , function() { $( this ).addClass( "flip" ); compareFlipped(); });
both had same effect.
No worries on this one, got it too work. used setTimeout
$(".pieceContainer" ).on( "click" , function() { $( this ).addClass( "flip" ); });
$(".pieceContainer" ).on( "click" , compareFlipped );
Calling two listeners. The 2nd listener's call to compareFlipped is blocking the transition I have when I add the class flip in the first listener. is there a way to delay this or allow the transition to finish? compareFlipped below if u need
function compareFlipped() {
var flipped = $( ".flip" );
if(flipped.length == 2) { var flipOne = $( ".flip .pieceBack" ).eq(0).attr("data-id");
} }