scroll

WebJar for scroll

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

scroll
Last Version

Last Version

2.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

scroll
WebJar for scroll
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/michaelrhodes/scroll

Download scroll

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/scroll/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>scroll</artifactId>
    <version>2.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/scroll/
implementation 'org.webjars.npm:scroll:2.0.3'
// https://jarcasting.com/artifacts/org.webjars.npm/scroll/
implementation ("org.webjars.npm:scroll:2.0.3")
'org.webjars.npm:scroll:jar:2.0.3'
<dependency org="org.webjars.npm" name="scroll" rev="2.0.3">
  <artifact name="scroll" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='scroll', version='2.0.3')
)
libraryDependencies += "org.webjars.npm" % "scroll" % "2.0.3"
[org.webjars.npm/scroll "2.0.3"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : rafl jar [1.2.1,1.3)

Project Modules

There are no modules declared in this project.

scroll

animates the scroll top/left position of an element

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

Versions

Version
2.0.3
2.0.1
1.0.0