scroll-smooth

1.1.1 • Public • Published

scroll-smooth

Scroll with smooth gestures

### API

/**
 * Simple 
 */
scrollSmooth.to(elem|position)

// like
scrollSmooth.to(document.querySelector('.myElem'))
// or 
scrollSmooth.to(700)

/**
 * With Options
 */
scrollSmooth.to(elem|position, {
  duration,
  context,
  offset,
  ease,
  callback,
})

// like
scrollSmooth.to(document.querySelector('.myElem'), {
  duration: 1500
  offset: 100,
  callback: elem => console.log(`Yup! Hi ${elem}!`),
})

// or 
scrollSmooth.to(document.querySelector('.another'), {
  context: document.querySelector('.parent')
  callback: elem => console.log(`Yup! ${elem} inside a context different than window!`),
})

Readme

Keywords

Package Sidebar

Install

npm i scroll-smooth

Weekly Downloads

45,008

Version

1.1.1

License

MIT

Unpacked Size

68.2 kB

Total Files

11

Last publish

Collaborators

  • elrumordelaluz