Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including css-scroll-by with all npm packages installed. Try it out:

var cssScrollBy = require("css-scroll-by")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

css-scroll-by v0.1.0

Scroll the page by a given offset using CSS transitions

css-scroll-by

Scroll the page by a given offset using CSS transitions

Manipulates the margin-top and margin-left style properties, then when the animation is complete, removes the margins, and moves the window scroll directly.

NPM

API

var scrollBy = require('css-scroll-by')

scrollBy(offset, duration)

offset can be a number (representing Y scroll) or an array containing [x,y] offset.

duration is the number of milliseconds the animation should take to complete.

Example

$ npm install beefy -g
$ npm run example

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free