simple-smooth-scroll-by
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

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

Dependencies (0)

    Dev Dependencies (8)

    Package Sidebar

    Install

    npm i simple-smooth-scroll-by

    Weekly Downloads

    2

    Version

    0.0.3

    License

    ISC

    Unpacked Size

    6.27 kB

    Total Files

    6

    Last publish

    Collaborators

    • onset