jQuery: eliminate white screen “pause” between animations

后端 未结 3 1169
陌清茗
陌清茗 2020-12-11 09:54

I have just discovered Barba.js and find it very useful. It provides smooth transitions between URLs of the same website.

I have put together a

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-11 10:31

    The white screen is the body color because you're using promise().done(..) jquery apply the fadeIn after the fadeOut finish so the body color will appear. So, this is an example sort of similar to what you have:

    
    
    
    

    like you see in the example above the white screen also appears so if you don't want that just don't use promise().done(..).

    $(document).ready(function(){
        $('div.one').click(function(){
            $(this).fadeOut(1000);
            $('div.Two').fadeIn(1000);
        });
    });
    

    you can edit your code like this:

    $(this.oldContainer).fadeOut(1000).promise().done(() => {
        $('html, body').animate({
            scrollTop: 300
        },1000);
    });
    nc.css('visibility', 'visible');
    nc.fadeIn(1000, function() {
        _this.done();
    });
    

提交回复
热议问题