anvaka / scroll-iv

Smooth cross browser scrollIntoView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

scroll-iv

Smooth cross browser scrollIntoView

usage

var scrollIntoView = require('scroll-iv')

// This will smoothly scroll element into view in all browsers using cubic
// bezier animation.
scrollIntoView(domElement)

// you can change scroll speed:
var animation = scrollIntoView(domElement, {
  duration: 800 // milliseconds
})

// if you decide that you need to cancel animation:
animation.cancel()

Second function argument is compatible with amator configuration You can pass different easing functions:

scrollIntoView(domElement, {
  easing: 'ease' // default is ease. Possible values: <ease|easeIn|easeOut|easeInOut|linear>
})

license

MIT

About

Smooth cross browser scrollIntoView

License:MIT License


Languages

Language:JavaScript 100.0%