I'm trying to execute these removeClass calls in succession. There doesn't seem to be a call back function using removeClass so is there another way to emulate this?
$("#card1").removeClass('flip');
//wait for card1 flip to finish and then flip 2
$("#card2").removeClass('flip');
//wait for card2 flip to finish and then flip 3
$("#card3").removeClass('flip');
It seems that you're using CSS3 transition for doing this. The easiest way to do this is to set delay manually:
$("#card1").removeClass('flip');
setTimeout(function(){
//wait for card1 flip to finish and then flip 2
$("#card2").removeClass('flip');
}, 500);
setTimeout(function(){
//wait for card2 flip to finish and then flip 3
$("#card3").removeClass('flip');
}, 1000);
There's no built in jQuery method to check that css transition is complete.
Old Tread but Goolge now him ;-)
jQueries UI has a extend Function for removeClass.
<div class="big-blue"></div>
$( "div" ).click(function() {
$( this ).removeClass( "big-blue", 1000, "easeInBack", function(){
// do fancy stuff after animation is completed
});
});
jQuery-UI Doc: http://api.jqueryui.com/removeclass/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.