draggable-scrollarea
v1.0.5
Published
Enable drag to scroll on any area with an overflow scroll
Downloads
144
Readme
draggable-scrollarea
Enable drag to scroll on any area with an overflow scroll.
Usage
You can load it from a CDN, with cdn version of library:
<script src="https://cdn.jsdelivr.net/npm/draggable-scrollarea@1"></script>
<script>
const draggableDiv = new DraggableScrollArea(document.querySelector('#draggable-div'));
</script>
Or you can import it via ES6 module:
npm i draggable-scrollarea
import DraggableScrollArea from 'path/to/draggable-scrollarea';
const draggableDiv = new DraggableScrollArea(document.querySelector('#draggable-div'));
Options
new DraggableScrollArea(element: HTMLElement);
Methods
| Method | Description |
| -------------------------- | ---------------------------------------------------- |
| forwards(void)
| Scroll forwards |
| backwards(void)
| Scroll backwards |
| hideOnStart(HTMLElement)
| Hide an element when scrollarea is at start position |
| hideOnEnd(HTMLElement)
| Hide an element when scrollarea is at the end |
| | |
License
(c) 2022 Arno CELLARIER. Licensed under the MIT license.