An open API service indexing awesome lists of open source software.

https://github.com/puemos/window-scroller

a window scroller impl vanila javascript
https://github.com/puemos/window-scroller

javascript scroller vanilajs

Last synced: about 1 year ago
JSON representation

a window scroller impl vanila javascript

Awesome Lists containing this project

README

          

# window-scroller

[![NPM](https://nodei.co/npm/window-scroller.png?downloads=true)](https://nodei.co/npm/window-scroller/)

## Credit:

@shunryu111

## Based on:

## install

```bash
npm install window-scroller --save
```

## usage

```javascript
import Scroller from 'window-scroller';
// OR
const Scroller = require('window-scroller');

// Position
Scroller.to(500).scroll()
Scroller.to(500).speed(700).scroll()
Scroller.to(500).easing('easeOutSine').scroll();
Scroller.to(500).speed(700).easing('easeInOutSine').scroll();

// Element in the DOM
const element = document.getElementById('rolling');
Scroller.to(element).scroll()
Scroller.to(element).speed(700).scroll()
Scroller.to(element).easing('easeInOutQuint').scroll();
Scroller.to(element).speed(700).easing('easeInOutQuint').scroll();

// Save the scroller and use whenever you need
const rollingScroller = Scroller.to(element).speed(700).easing('easeInOutQuint');
rollingScroller.scroll()

const topScroller = Scroller.to(0).speed(700).easing('easeOutSine');
topScroller.scroll()
```

## options

speed (Integer):

- 0 -> inf

easing (String):

- easeOutSine
- easeInOutSine
- easeInOutQuint

to (Integer | Element):

- DOM Element
- Integer