1.0.7 • Published 8 years ago

smooth-page-scroll v1.0.7

Weekly downloads
2
License
MIT
Repository
github
Last release
8 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

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago