The solution described at the end of this question (checking for document.scrollingElement or returning to document.body ) will not work on IE because it does not support document.scrollingElement ( docs ), and in IE the scroll element is an HTML element.
I would suggest that the best solution for this would be something like:
var scrollNode = document.scrollingElement || document.documentElement;
What should work for all modern browsers.
As a side element, itβs interesting to take into account that the scrollingElement property seems to have been added for the sole purpose of making it such that we donβt need checks / backups to get the root scroll element, but because of more browser incompatibility, we still need to check / backup to use scrollingElement .
Don't you like a web developer?
Pudge601 Sep 12 '17 at 16:19 on 2017-09-12 16:19
source share