Why do fixed elements slow down scrolling in Firefox?

匿名 (未验证) 提交于 2019-12-03 08:41:19

问题:

Why do elements with the CSS position: fixed applied to them cause Firefox to eat 100% CPU when scrolling the page they are in? And are there any workarounds?

I've noticed this behavior on a few sites, for example the notification bar at the top of the page on StackOverflow. I'm using Linux in case that matters.

回答1:

This is bug #201307.



回答2:

It's a bug reported in bugzilla

Apparently a work-around (with mixed reports of success..) is to disable smooth-scrolling

Just disable smooth scrolling in Edit > Preferences > Advanced.



回答3:

As already stated, this is bug #201307. The workaround is to disable smooth scrolling:

Edit -> Prefrences -> Advanced -> General tab -> uncheck "Use smooth scrolling"



回答4:

This website has a fixed element "First time at Stack Overflow? Check out the FAQ!", and it's slow as hell in firefox. Works better with Opera and Chrome though. FF3, Windows XP, ATI.



回答5:

it eats CPU because the browser has to repaint the entire viewport every scroll change rather than just the newly visible area



回答6:

Are you sure that there's a direct link here? Have you created a static HTML page with fixed elements to verify your theory? Given how widely these CSS properties are used, I'd think someone else would have noticed it by now, whatever browser/OS you're running.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!