js防止DIV布局滚动时闪动的解决方法

时间:2021-01-19 18:00:23
【文件属性】:
文件名称:js防止DIV布局滚动时闪动的解决方法
文件大小:52KB
文件格式:PDF
更新时间:2021-01-19 18:00:23
div js js代码 本文实例讲述了js防止DIV布局滚动时闪动的方法,分享给大家供大家参考。具体方法如下: 最近接触页面性能的东西,有很多细微又原始的内容,比如浏览器渲染。资料非常多,所以选一些做节译,备忘。 JavaScript多次写、读DOM就会发生「布局颠簸」,引起文档重排(reflow – the process of constructing a render tree 代码如下:from a DOM tree1)。 // 读 var h1 = element1.clientHeight; // 写 (布局作废) element1.style.height = (h1 * 2) + ‘px’; //

网友评论