Why is opera animation so slow?

感情迁移 提交于 2019-12-24 12:14:22

问题


It seems as though opera doesn't play nice with multiple animations going on simultaneously, check out this theme I'm building. I've made a preloader which scatters the images outside body in random places then animates each of them into place in intervals of 0.1 seconds with the animation taking 0.8 seconds.

Here's the function I made:

function ea_preload_scatter() {

    if(item.length) {

        var scatter = $(window).height() + $(window).width();

        item.addClass('loading').each(function() {

            var positionX = ['','-'],
                positionY = ['','-'],
                x = Math.floor(Math.random()*2),
                y = Math.floor(Math.random()*2);

            if(positionX[x] === '-') {
                posX = -scatter;
            } else {
                posX = scatter;
            }

            if(positionY[y] === '-') {
                posY = -scatter;
            } else {
                posY = scatter;
            }                

            $('img', this).addClass('absolute').css('top',posX).css('left',posY);

        });

        $(window).load(function() {

            var i = 0,
                speed = 800;

            function ea_scatter_animate(e) {

                $('img',item.eq(e)).css({
                    zIndex: '10000'+e
                }).stop().animate({
                    top:0,
                    left:0
                }, speed, 'easeInOutExpo', function() {
                    $(this)
                        .removeClass('absolute')
                        .removeAttr('style')
                        .parent()
                        .removeClass('loading');
                });

                var t = setTimeout(function() {
                    if(e == item.length) {
                        clearTimeout(t);
                    } else {
                        ea_scatter_animate(i++);
                    }
                }, 100);

            }

            ea_scatter_animate(i);

        });

    }

}

Opera:

Version
11.51

Build
1087

Mac:

Platform
Mac OS X

System
10.6.8

Processor 
2.93 GHz Intel Core i7

Memory 
8GB 1333 MHz DDR3

So is there anything I can do to make this play nicely with Opera? Or is it just Opera being Opera?

来源:https://stackoverflow.com/questions/7460942/why-is-opera-animation-so-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!