A function to get the scrolling parent of a html element.
npm install scrollparent --savevar Scrollparent = require("scrollparent");
Scrollparent(document.getElementById("content")) // HTMLHtmlElement or HTMLBodyElement as appropriatevar Scrollparent = require("scrollparent");
Scrollparent(document.getElementById("inside-a-scrolling-div")) // HTMLDivElementInternally, the root scrolling element is determined in this library as the result of
document.scrollingElement || document.documentElement;This should give a usable result in most browsers today
but if you want to ensure full support
you should use a document.scrollingElement polyfill such as
this one.
MIT