jQuery animate() and browser performance

后端 未结 7 722
小蘑菇
小蘑菇 2020-12-03 09:48

I\'ve got some elements that I\'m moving across the page very slowly. Essentially, I\'m decreasing the left margin of two images over a span of 40 seconds or so.

Vi

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 10:29

    Animations involve looping operations, and those will really crunch the CPU no matter what.

    I dont know how easy it is to do with jQuery, but what needs to happen is the animation needs to consume less cycles. Either you make the ani a little more jagged (the display isnt as smooth), the looping needs to be optimized, or reduce the work of the ani.

    40 seconds? isnt that a bit long for an animation? I thought they are sposed to be a little more immediate than that.

提交回复
热议问题