Can I do anything about “repaints on scroll” warning in Chrome for “overflow:scroll” div

后端 未结 4 516
执念已碎
执念已碎 2020-12-12 22:03

In Chrome DevTools, under Rendering, there\'s an option to \"Show potential scroll bottlenecks\".

When I enabled this, some div elements I have on the s

4条回答
  •  猫巷女王i
    2020-12-12 22:32

    Although the accepted answer solves the problem, it is worth looking at the CSS will-change property. This is preferred over transform: translateZ(0); in recent times. Here is an that article explains the difference in detail - https://dev.opera.com/articles/css-will-change-property/

    .scroll-container {
      will-change: transform;
    }
    

提交回复
热议问题