0.0.0 • Published 8 years ago
ds-smooth-scroll
Licence
MIT
Version
0.0.0
Deps
0
Size
13 kB
Vulns
0
Weekly
0
ds-smooth-scroll ( Don't Need jQuery )
ds-smooth-scroll.jsは、jQueryを必要としないスムーススクロール機能のライブラリです。
- Target browser : IE9+
Install
npm i ds-smooth-scroll -S
Import
import DsSmoothScroll from 'ds-smooth-scroll';
Constructor
new DsSmoothScroll(element [, option]);
| Argument | Data type | Default | Descroption |
|---|---|---|---|
| speed | Number | 800 | スクロールスピードを指定できます。 |
| easing | String | "linear" | 下記からイージングを指定できます。 "linear" "easeInCubic" "easeOutCubic" "easeInOutCubic" "easeInQuart" "easeOutQuart" "easeInOutQuart" "easeInQuint" "easeOutQuint" "easeInOutQuint" |
| posFix | Number | 0 | ヘッダー分のマイナス値を指定できます。 |
| ignore | String | - | イベントを除外する要素を指定できます。 |
| blank | Boolean | false | ページ遷移ありのアンカーリンク。 |
| customAnchor | String | "#/" | blank: trueの時有効 "?anchor="、"?id=" などを指定します。 |
Method
| Method | Argument | Descroption |
|---|---|---|
| SmoothScroll( Number ) | - | 引数に指定した位置にスクロールします。 |
| ScrollEnd = function(){}; | - | スクロール完了後に実行されます。 |
Demo
https://dsflon.github.io/ds-smooth-scroll/
import DsSmoothScroll from 'ds-smooth-scroll';
let dsScroll = new DsSmoothScroll(
"a",
{
easing: "easeOutQuint",
ignore: ".ignore",
posFix: 60,
blank: true,
}
);
dsScroll.ScrollEnd = function(){
console.log("ScrollEnd")
};