最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

performance - Javascript: Does modifying scrollTopscrollLeft trigger browser reflow? - Stack Overflow

programmeradmin4浏览0评论

I'm wondering if animating the scrollbars with Javascript triggers browser reflow.

Any difference across different browser implementations?

window.pageXOffset & window.pageYOffset
document.documentElement.scrollLeft & document.documentElement.scrollTop
document.body.scrollLeft & document.body.scrollTop

Thanks!

I'm wondering if animating the scrollbars with Javascript triggers browser reflow.

Any difference across different browser implementations?

window.pageXOffset & window.pageYOffset
document.documentElement.scrollLeft & document.documentElement.scrollTop
document.body.scrollLeft & document.body.scrollTop

Thanks!

Share Improve this question asked Mar 9, 2010 at 23:12 Jon RaaschJon Raasch 3,9837 gold badges32 silver badges32 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 12

I dug in deeper and found this link which says it does cause reflow: http://www.phpied./rendering-repaint-reflowrelayout-restyle/

I also tested it and modifying scrollTop and scrollLeft both trigger reflow (in Firefox at least).

Heh sorry for answering my own question, but hopefully this info is useful for someone :).

According to this question, no.

发布评论

评论列表(0)

  1. 暂无评论