Jquery .when() and .then() not working?
I had try something with the below:
$.when($(smtg).fadeOut(300)).then($(smtg).fadeIn(300));
What's wrong with it while the document at http://api.jquery.com/jQuery.whe开发者_JAVA技巧n/ Chrome console says Uncaught type error: has no method when
@@''
Edit: You need jQuery 1.5+
OR simply do this:
$(smtg).fadeOut(300, function() {
$(smtg).fadeIn(300);
});
This basically runs the fadeOut first, once the animation is done then it will run the callback function in our case the fadeIn
Simplest possibility, you are using an older (than 1.5) version of jQuery.
精彩评论