Skip to content

Smooth element scrolling with requestAnimationFrame and the Tween component

Notifications You must be signed in to change notification settings

danilvalov/element-scroll-top

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

element-scroll-top

Smooth element scroll to position with requestAnimationFrame and Tween.

Installation

$ component install component/element-scroll-top

API

elementScrollTop(element, top, [options])

Scroll to the given point top with the given options:

  • ease easing function defaulting to "out-circ" (view ease for more)
  • duration animation duration defaulting to 1000
var elementScrollTop = require('element-scroll-top');

var element = document.getElementById('test');

elementScrollTop(element, 1200, {
  ease: 'out-bounce',
  duration: 1500
});

License

MIT

About

Smooth element scrolling with requestAnimationFrame and the Tween component

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 51.9%
  • JavaScript 40.5%
  • Makefile 7.6%