Miss any of our Open RFC calls?Watch the recordings here! »

scrollparent-q5

2.0.1 • Public • Published

scrollparent.js

A function to get the scrolling parent of an html element.

Install

npm install scrollparent --save

Example

var Scrollparent = require("scrollparent");
 
Scrollparent(document.getElementById("content")) // HTMLHtmlElement or HTMLBodyElement as appropriate
var Scrollparent = require("scrollparent");
 
Scrollparent(document.getElementById("inside-a-scrolling-div")) // HTMLDivElement

Note about the root scrolling element

Internally, 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.

Contributors

  • Ola Holmström (@olahol)
  • Bart Nagel (@tremby)
  • Daniel White (@danbrianwhite)

License

MIT

Install

npm i scrollparent-q5

DownloadsWeekly Downloads

79

Version

2.0.1

License

ISC

Unpacked Size

9.68 kB

Total Files

7

Last publish

Collaborators

  • avatar