0.0.3 • Published 2 years ago

simple-smooth-scroll-by v0.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Simple smooth scrollBy npm Dependencies npm type definitions

Smoothly scrolls by x and y pixels. Demo.

Detects native support of smooth scroll-behavior and fallbacks to tiny reimplementation using requestAnimationFrame loop.

Installation

npm install simple-smooth-scroll-by

How to use

JavaScript:

import { scrollBy } from 'simple-smooth-scroll-by'

scrollBy(window, 0, 200) // Scroll right by 200px

// or

const container = document.querySelector('#container')
scrollBy(container, 100, 0) // Scroll down by 100px