smooth-scroller

WebJar for smooth-scroller

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

smooth-scroller
Last Version

Last Version

2.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

smooth-scroller
WebJar for smooth-scroller
Project URL

Project URL

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

Source Code Management

https://github.com/firstandthird/smooth-scroller

Download smooth-scroller

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : domassist jar [2.2.0,3)

Project Modules

There are no modules declared in this project.

Smooth-scroller

npm

A tiny, ES6 JavaScript lib to handle smooth scrolling.

Installation

npm install smooth-scroller

Usage

See the full example.

Javascript

import 'smooth-scroller';

HTML

<a href="#foo" data-smooth>Scroll Smoothly</a>
...some content...
<div id="foo"></div>

Events

Custom events are fired on the element:

Event Description
smoothscroll:start Smooth scroll starts
smoothscroll:end Smooth scroll ends

Methods

Smooth-scroller exposes two methods:

init([selector='[data-smooth]'], [offset=0])

Enables smooth-scroller on the elements matched by selector.

Parameters

selector='[data-smooth]' - {String} - Elements that will trigger smooth-scroll call once they're clicked

offset=0 - {Number} - Controls the distance (negative or positive) between the top border of the element and the top border of the window.

scroll(target, hash, [offset=0], [silent=false])

target - {string|Element|NodeList} - Target element to scroll

hash - {string|Element|NodeList} - DOM element ID to scroll

offset=0 - {Number} - Controls the distance (negative or positive) between the top border of the element and the top border of the window.

silent=false - {Boolean} - If enabled, will generate a history.pushState event

org.webjars.npm

First+Third

We build things... awesome things.

Versions

Version
2.2.1