开发者

Jquery .when() and .then() not working?

开发者 https://www.devze.com 2023-02-17 06:43 出处:网络
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/

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消