draggable-scrollarea

1.0.5 • Public • Published

draggable-scrollarea

Enable drag to scroll on any area with an overflow scroll.

Short GIF animation that show a draggable image caroussel

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.

Readme

Keywords

Package Sidebar

Install

npm i draggable-scrollarea

Weekly Downloads

47

Version

1.0.5

License

MIT

Unpacked Size

26.7 kB

Total Files

11

Last publish

Collaborators

  • arnoclr