3.0.1 • Published 5 years ago

scroll v3.0.1

Weekly downloads
124,496
License
MIT
Repository
github
Last release
5 years ago

scroll

animates the scroll top/left position of an element (in 340 bytes)

browser support

note: you may need to polyfill requestAnimationFrame in older browsers

install

npm install scroll

use

var scroll = require('scroll')
var page = require('scroll-doc')()
var ease = require('ease-component')

// Basic usage
scroll.left(page, 200)

// Register a callback
scroll.top(page, 200, function (err, scrollTop) {
  console.log(err)
  // { message: "Scroll cancelled" } or
  // { message: "Element already at target scroll position" } or
  // null

  console.log(scrollTop)
  // => The new scrollTop position of the element
  // This is always returned, even when there’s an `err`.
})

// Specify a custom easing function
scroll.left(page, 200, { ease: ease.inBounce })

// Specify a duration in milliseconds (default: 350) and register a callback.
scroll.left(page, 200, { duration: 1000 }, function (err, scrollLeft) {
})

// Cancel a scroll animation
var options = { duration: 1000 }
var cancel = scroll.top(page, 200, options, function (err, scrollTop) {
  console.log(err.message)
  // => Scroll cancelled

  page.removeEventListener('wheel', cancel)
})

page.addEventListener('wheel', cancel)

note: the default easing is inOutSine from component/ease.

obey

MIT

crehana-material-uihexidave-material-ui-next@infinitebrahmanuniverse/nolb-scro@everything-registry/sub-chunk-2720@martsforever/am-vuehv-react-joyridehs-react-joyridem-react-components-libraryinferno-joyridematerial-ui-realadvisormaterial-ui-reladvisormaterial-ui-scrollable-tabsmaterial-ui-scrollable-tabs2marudor-react-joyridematerial-ui-alphamaterial-ui-build-nextmaterial-ui-cordovamaterial-ui-nextmaterial-ui-next-algestimote-react-joyrideflick-joyridemy-test-joyridemui-scrollable-tabsmeituan-changshihangmeituan-changshihang1moblee-uimjlescano-material-uimax-uimosaiqjoyrideminta-studioreact-joyride-testreact-joyride-with-nextreact-joyriderreact-joyride-multi-spotlight-forkreact-joyride-nextreact-joyride-q5react-joyride-restart-fixreact-joyride-scrollparentreact-joyridereact-joyride-casecreact-joyride-forkreact-joyride-forkedreact-joyride-gsseanthchao-testsanjeev-react-joyriderheo-react-joyriderheo-test-react-joyridersoury-marketplacerr-componentsreact-tooltipperttk-rc-introubiatar-material-uiunderdog-react-redux-formsphere-sdksnappy-react-scroll-paginatortlvince-material-ui@kuveytturk/boa-components@krzysztofkarol/material-ui@makeomatic/material-ui-scrollable-tabs@newhippo/react-joyride@pry-financials/react-joyridezifnab87-material-ui-scrollable-tabs-build@examind/react-joyride@raona/joyrideux-tour@minh.nguyen/material-ui@lskjs/react-joyride@lyra/components@material-next/core@gebruederheitz/clicktrigger2@fondi/material-ui@invisionag/react-joyride@geosolutions/react-joyride@telkomdesign/colors@telkomdesign/colortest@telkomdesign/icons@telkomdesign/iconstest@telkomdesign/styles@telkomdesign/stylestest@telkomdesign/tedis-reactjs-componentvirtual-tour-guide@hugo-team/react-joyride@keyteq/finn-widget-web@evansjohnson/react-joyride@evergis/ui@evergis/uilib-gl@edaider/react-joyride@gilbarbara/components@harsharyacnu/ti-react-tour@6thquake/react-material@aborovsky/react-joyride@sur-la-table/slt-ui@ucheol2/react-joyride@stepanenko3/js-utils@weareroam/cake-ui-v1@artofrawr/profound-ui@aliath2/react-joyride@tesglobal/react-joyride@contentpass/material-ui@ctco-dev/material-ui-scrollable-tabs
3.0.1

5 years ago

3.0.0

5 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

7 years ago

2.0.0

8 years ago

1.0.1

8 years ago

1.0.0

9 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago