scroll-to-element

WebJar for scroll-to-element

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

scroll-to-element
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

scroll-to-element
WebJar for scroll-to-element
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/willhoag/scroll-to-element

Download scroll-to-element

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : scroll-to jar 0.0.2

Project Modules

There are no modules declared in this project.

scroll-to-element

Smooth scrolls to element of the specified selector or element reference with optional offset, scroll-positon, easing, and duration. Takes into account document height for elements low on the page.

NPM

scrollToElement(selector, <options>)

Valid options:
offset : number

Add an additional offset to the final position. if > 0 then page is moved to the bottom otherwise the page is moved to the top.

align : string

Alignment of the element in the resulting viewport. Can be one of 'top', 'middle' or 'bottom'. Defaulting to 'top'.

ease : string

Easing function defaulting to "out-circ" (view ease for more)

duration : number

Animation duration defaulting to 1000

Callback support

scrollToElement emits an end event when the scroll animation is complete, and can be optionally consumed to perform a callback.

EXAMPLE

var scrollToElement = require('scroll-to-element');

scrollToElement('#id');

// with options
scrollToElement('.className', {
	offset: 0,
	ease: 'out-bounce',
	duration: 1500
}).on('end', () => {
	console.log('Done scrolling!');
});

// or if you already have a reference to the element
var elem = document.querySelector('.className');
scrollToElement(elem, {
	offset: 0,
	ease: 'out-bounce',
	duration: 1500
});

LICENSE

MIT

Versions

Version
2.0.0