A function to get the scrolling parent of an html element.
npm install scrollparent-q5> A function to get the scrolling parent of an html element.
``bash`
npm install scrollparent --save
`js
var Scrollparent = require("scrollparent");
Scrollparent(document.getElementById("content")) // HTMLHtmlElement or HTMLBodyElement as appropriate
`
`js
var Scrollparent = require("scrollparent");
Scrollparent(document.getElementById("inside-a-scrolling-div")) // HTMLDivElement
`
Internally, the root scrolling element is determined in this library
as the result of
`js`
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.
* Ola Holmström (@olahol)
* Bart Nagel (@tremby)
* Daniel White (@danbrianwhite)
MIT