3.0.1 • Published 6 years ago

scroll v3.0.1

Weekly downloads
124,496
License
MIT
Repository
github
Last release
6 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-vueux-tour@dnnsoftware/dnn-react-common@ctco-dev/material-ui-scrollable-tabs@contentpass/material-ui@fondi/material-uisphere-sdkubiatar-material-uitlvince-material-uittk-rc-intro@artofrawr/profound-ui@aliath2/react-joyride@aborovsky/react-joyride@6thquake/react-material@deriv/react-joyride@defihelper/react-joyride@delewis13/react-joyridezifnab87-material-ui-scrollable-tabs-buildvirtual-tour-guideunderdog-react-redux-form@fazendatech/react-joyride@harsharyacnu/ti-react-tour@hugo-team/react-joyride@gebruederheitz/clicktrigger2@evergis/ui@evergis/uilib-gl@evansjohnson/react-joyride@gilbarbara/components@geosolutions/react-joyride@kuveytturk/boa-components@krzysztofkarol/material-ui@lskjs/react-joyride@makeomatic/material-ui-scrollable-tabs@lyra/components@newhippo/react-joyride@examind/react-joyride@edaider/react-joyride@material-next/core@minh.nguyen/material-ui@invisionag/react-joyride@keyteq/finn-widget-web@dvcorg/gatsby-theme-iterative@raona/joyride@pry-financials/react-joyridemui-scrollable-tabsmy-test-joyridemosaiqjoyrideminta-studiomoblee-uimjlescano-material-uirr-componentsrsoury-marketplacesanjeev-react-joyridereact-joyridereact-joyride-casecreact-joyride-forkreact-joyride-forkedreact-joyride-gsreact-joyride-multi-spotlight-forkreact-joyride-nextreact-joyride-q5react-joyride-react-19react-joyride-restart-fixreact-joyride-scrollparentreact-joyride-testreact-joyride-with-nextreact-joyriderseanthchao-testrheo-react-joyriderheo-test-react-joyridesnappy-react-scroll-paginatorreact-tooltipperinferno-joyridehs-react-joyridehv-react-joyridemarudor-react-joyridematerial-ui-realadvisormaterial-ui-reladvisormaterial-ui-scrollable-tabsmaterial-ui-scrollable-tabs2material-ui-nextmaterial-ui-next-algm-react-components-librarymaterial-ui-build-nextmaterial-ui-cordovamaterial-ui-alphamax-uimeituan-changshihangmeituan-changshihang1@weareroam/cake-ui-v1@whartongroup/react-joyride@ucheol2/react-joyride@yelo/saber-theme-snow@stepanenko3/js-utils@sur-la-table/slt-ui@telkomdesign/colors
3.0.1

6 years ago

3.0.0

6 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

8 years ago

2.0.0

9 years ago

1.0.1

9 years ago

1.0.0

10 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago

0.0.0

11 years ago