1.0.7 • Published 10 years ago

smooth-page-scroll v1.0.7

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

smooth-page-scroll

Easy replacement for in-page hash-link scrolling.

Note: This lib requires window.{request,cancel}AnimationFrame, history.{push,replace}State.

Demo

See https://leader22.github.io/smooth-page-scroll

Install

by npm.

npm i smooth-page-scroll --save

by script tag.

<script src="./path/to/smooth-page-scroll.min.js"></script>

then,

// for CommonJS
var SmoothPageScroll = require('smooth-page-scroll');

SmoothPageScroll.install();

finally,

<a href="#dest">Go!</a>

<div id="dest">
  Destination
</div>

Options

You can pass options as install(options).

propstypedefaultdesc
gapXnumber40Gap for destination posX.
gapYnumber40Gap for destination posY.
durationnumber500Duration for scrolling.
easingfunct => t*(2-t)Easing function for scrolling.
useHashAsHistorybooltrueIf true, pushState on hash has changed.
1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago