Skip to content

dariocravero/scroll-to-y-el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scrollToY

Vertically scroll to an Element using requestAnimationFrame.

Inspired by http://stackoverflow.com/a/26808520.

Usage

// In node
var scrollToY = require('scroll-to-y');
// In the browser just include the source file

scrollToY('someElementId'), {
  easing: function(pos) {
    return -(Math.pow((pos - 1), 2) - 1);
  },
  speed: 1000,
  offset: 100
});

Easing functions

MIT. (c) 2015 Darío Javier Cravero dario@uxtemple.com

About

Vertically scroll to an Element using requestAnimationFrame.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published