Firefox中的jQuery问题?

时间:2017-08-01 16:49:28

标签: javascript jquery html

我一直在寻找飞行推车效果,我得到了一个在Chrome中运行良好但在Firefox中不太好的一个。有人可以帮我解决这个问题吗?这种效果在Firefox中看起来并不好看,但在Chrome中效果很好。

如果有人需要该页面进行测试,请尝试以下方法: http://mundobodega.com/depositos-de-vino-fermentadores-ino

function flyToElement(flyer, flyingTo) {    
    var $func = $(this);   
    var divider = 3;   
    var flyerClone = $(flyer).clone();   
    $(flyerClone).css({position: 'absolute', top: $(flyer).offset().top + "px", left: $(flyer).offset().left + "px", opacity: 1, 'z-index': 1000});   
    $('body').append($(flyerClone));   
    var gotoX = $(flyingTo).offset().left + ($(flyingTo).width() / 2) - ($(flyer).width()/divider)/4;   
    var gotoY = $(flyingTo).offset().top + ($(flyingTo).height() / 2) - ($(flyer).height()/divider)/4;   

    $(flyerClone).animate({
        opacity: 0.4,
        left: gotoX,
        top: gotoY,
        width: $(flyer).width()/divider,
        height: $(flyer).height()/divider
    }, 700,
    function () {
        $(flyingTo).fadeOut('slow', function () {
            $(flyingTo).fadeIn('slow', function () {
                $(flyerClone).fadeOut('slow', function () {
                    $(flyerClone).remove();
                });
            });
        });
    });
}

 $(document).ready(function(){         
     $('.addtocart').on('click',function(){    
        //Scroll to top if cart icon is hidden on top    
        $('html, body').animate({
            'scrollTop' : $("#vercesta").position().top
        });
        //Select item image and pass to the function    
        var itemImg = $('.img0');
        flyToElement($(itemImg), $('#vercesta'));
    });    
});    

0 个答案:

没有答案