Why are slow jQuery animations choppy?

前端 未结 3 2312
梦谈多话
梦谈多话 2021-02-19 19:15

I\'m having a hard time googling this issue because most of the things I can find are about animations that are supposed to be fast but are acting slow. My question is regarding

3条回答
  •  迷失自我
    2021-02-19 19:53

    I think it has something to do with how often you move an element. For example, if you move the object once every second, it will seem choppy. Try decreasing the amount of time between each move as well as decreasing the distance between each move. See http://jsfiddle.net/2K9xP/ for an example.

    So we have...

    var duration = Math.round(10 * distance);
    

    instead of...

    var duration = Math.round(1000 * distance);
    

提交回复
热议问题