为什么html运行之后不滚动,为什么很多移动端的HTML UI,在滚动时都用transform属性而不是用传统的滚动条?...
關鍵不在硬件加速,而在於是否 reflow。
A reflow is a more significant change. This will happen whenever the DOM tree is manipulated, whenever a style is changed that affects the layout, whenever the className property of an element is changed, or whenever the browser window size is changed.
使用 margin/top 修改會觸發 reflow,拖慢速度。
Elements that are positioned absolutely or fixed, do not affect the layout of the main document, so if they reflow, they are the only thing that reflows. The document behind them will need to repaint to allow for any changes, but this is much less of a problem than an entire reflow.
absolute 和 fixed 的元素的 reflow 不會牽動整體,但依舊不如 transform 只需要 repaint。
而 translate 和 translate3d 的區別則在於硬件加速。
總結
以上是生活随笔為你收集整理的为什么html运行之后不滚动,为什么很多移动端的HTML UI,在滚动时都用transform属性而不是用传统的滚动条?...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CUDA学习笔记之 CUDA存储器模型
- 下一篇: 禅道报表中关闭bug统计图_想要简单制作