If you have something like this:
html, body { height: 100%; overflow:auto; }
If both body and html have a height definition of 100% and also scrolling enabled, window.scrollTo (and all derived scrolling mechanisms) do not work, despite a scrollbar being displayed (which can be used by the user), when the contents exceed that 100% body height.
This is because the scrollbar you see is not that of the window, but that of the body.
Solution:
html { height: 100%; overflow:auto; }
body { height: 100%; }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…