scroll-doc
Feature detected access to the scroller element
Last updated 10 years ago by greengremlin .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install scroll-doc 
SYNC missed versions from official npm registry.

scrollDoc

Feature detected access to the scroller element

import scrollDoc from 'scroll-doc';

const scrollElement = scrollDoc();

// scroll to the top
scrollElement.scrollTop = 0;

How it works

ScrollDoc uses feature detection to detect which element is valid for scrolling the document. It attempts to scroll 1px using document.documentElement if it succeeds, it will reset document.documentElement to it's original scroll position and return document.documentElement; if it fails, it will return document.body. The result is cached and the cached value is returned on subsequent calls.

Current Tags

  • 0.2.1                                ...           latest (8 years ago)

5 Versions

  • 0.2.1                                ...           8 years ago
  • 0.2.0                                ...           9 years ago
  • 0.1.3                                ...           10 years ago
  • 0.1.2                                ...           10 years ago
  • 0.1.1                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |