JSPM

scrollparent-q5

2.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q13261F
  • License ISC

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

Package Exports

  • scrollparent-q5

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (scrollparent-q5) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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