jQuery淡出然后淡入 [英] jQuery fade out then fade in

查看:76
本文介绍了jQuery淡出然后淡入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于这个话题有很多,但是我找不到适合我情况的实例.

There's a bunch on this topic, but I havn't found an instance that applies well to my situation.

淡出图片,然后淡入另一张图片.相反,我遇到了一个问题,第一个淡出,然后立即(在动画完成之前)下一个淡入.

Fade a picture out and then fade another picture in. Instead, I'm running into an issue where the first fades out and immediately (before the animation is finished) the next fades in.

我读过一次,不记得确切的窍门了.

I read about this once and can't remember exactly what the trick was..

http://jsfiddle.net/danielredwood/gBw9j/

感谢您的帮助!

推荐答案

在淡出回调中淡入另一个,淡出回调在完成淡出时运行.使用您的代码:

fade the other in in the callback of fadeout, which runs when fadeout is done. Using your code:

$('#two, #three').hide();
$('.slide').click(function(){
    var $this = $(this);
    $this.fadeOut(function(){ $this.next().fadeIn(); });
});

或者,您可以暂停"链,但是需要指定多长时间:

alternatively, you can just "pause" the chain, but you need to specify for how long:

$(this).fadeOut().next().delay(500).fadeIn();

这篇关于jQuery淡出然后淡入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆