本文介绍了JQuery的 - 动画期间滞后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要得到一些内容时,正在改变的影响。这里是我的jquery- code:

I have to get some effects when content is changing. Here is my jquery-code:

function contentHide( parentElement, callback )
{
    parentElement.animate({
        "height" : "hide", "opacity" : 0.0
    }, "slow", "linear", callback);
}

function contentShow( parentElement )
{
    parentElement.animate({
            "height" : "show", "opacity" : 0.7
    }, "slow", "linear");
}

和内容时,是改变我有一个很大的滞后。在页面上的一切第一秒就可以了。

And when content is changing I have a big lags. At first seconds on the page everything is ok.

推荐答案

动画非常处理器耗电。我总是试图把它限制在一个时间(如果可能),以限制CPU拉动画1财产。例如通过回调动画的高度则混浊,有点像;

Animations are very processor power hungry. I've always tried to limit it to animating 1 property at a time (where possible) to limit the cpu pull. for example animate the height then the opacity via the callback, something like;

parentElement.animate(
    {"height" : "hide"}, "slow", "linear", function() {
        parentElement.animate({"opacity" : 0.0}, "slow", "linear", callback);
    }
);

这篇关于JQuery的 - 动画期间滞后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-12 13:20