7

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!

Jon Raasch
  • 3,703
  • 6
  • 30
  • 32

2 Answers2

12

I dug in deeper and found this link which says it does cause reflow: http://www.phpied.com/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 :).

Jon Raasch
  • 3,703
  • 6
  • 30
  • 32
  • Nice article, thanks. And sorry I was too hasty to answer this question without thorough research. – Marcel Korpel Mar 11 '10 at 12:18
  • yes, triggers reflow, according to my test and the comprehensive list from Paul Irish: https://gist.github.com/paulirish/5d52fb081b3570c81e3a – HolgerJeromin Jun 05 '19 at 13:50
1

According to this question, no.

Community
  • 1
  • 1
Marcel Korpel
  • 21,536
  • 6
  • 60
  • 80