jQuery fade out then fade in

前端 未结 4 637
失恋的感觉
失恋的感觉 2020-12-08 07:08

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

4条回答
  •  心在旅途
    2020-12-08 07:28

    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();
    

提交回复
热议问题