Inertial smooth scroll library
npm install descartia-js
descartia.js descartia.jsを読み込むhtml
`
#### 2. Write HTML in the proper style
html要素を下のようにマークアップする
`html
Page Contents.
`
#### 3. Apply styles to the elements
スタイルを以下のように適用する
`css
.d-page{
width: 100%;
height: 100%;
overflow: hidden;
}
.d-page-fixed{
position: fixed;
}
.d-dummy-scroll{
width: 100%;
height: 0;
position:absolute;
top: 0;
left: 0;
z-index: -1;
}
`
OR load css`html
`
descartia.js calculates scrollable length from height of .d-table. All child elements of .d-table should be position: static; (default of position). In the case of using 'fixed' or 'absolute', proper height value must be applied to .d-table before descartia.js execution and after every resize event. (not recommended)Methods
To start (and resume) descartia.js
descartia.jsを動作させるには以下のメソッドを呼び出します`javascript
Descartia.start();
`
This method initializes variables related to HTML elements, ids, and classes, and
can be used only once. If you want to use it again, for example in the case of pjax / ajax, call Descartia.disable(); or Descartia.pause(); first. Then you will able to call this method again.
To disable smooth scroll and enable default scroll
descartia.jsを無効にして標準スクロールに切り替える場合
`javascript
Descartia.disable();
`
To pause smooth scroll and other descartia.js events
descartia.jsのイベントとレンダリングを一時停止する場合
`javascript
Descartia.pause();
`
Optional: To set minimum window width limit descartia.js works. (This method should be declared before Descartia.start();)
レスポンシブレイアウトでスムーススクロールが無効化されるウィンドウ幅を設定したい場合、以下のメソッドをDescartia.start();の前に呼び出します。
`javascript
Descartia.setMinWidth(width_value_without_px);
Descartia.setMinWidth(600); //descartia.js stops and default scroll will be enabled if width <= 600
Descartia.setMinWidth(); //null will clear min width limit
``