Skip to main content

拖拽通过改变 position 或 translate 做位移,可以改变性能吗?

有提升,因为 top/right/bottom/left 可能影响元素的尺寸,进而影响内部元素的尺寸和布局,浏览器需要对相关部分进行 layout 重计算(CSS Triggers),transform 则无此问题(CSS Triggers)。

参考文章:https://www.zhihu.com/question/55463211