scrollable-elements

Get scrollable elements in specified selector

Usage no npm install needed!

<script type="module">
  import scrollableElements from 'https://cdn.skypack.dev/scrollable-elements';
</script>

README

scrollable-elements

Build Status npm version License

Get scrollable elements in specified selector.
Work in IE 9+ and modern browsers.

There are no dependencies on this module.

Install

Installed from npm.

$ npm install scrollable-elements

API

findAll( selectors, direction )

selectors: String
direction: String("x" | "y") Default("y")

Get all scrollable elements from in specified selector.
It returns an empty array if the element is not found.

import {findAll} from "scrollable-elements"

const elements = findAll(".scrollable");
console.log(elements); // [Element, Element, ...]

find( selectors, direction )

selectors: String
direction: String("x" | "y") Default("y")

Get first found scrollable element in specified selector.
It returns an undefined if the element is not found.

import {find} from "scrollable-elements"

const element = findAll(".scrollable");
console.log(element); // Element

Author

tsuyoshi wada