Javascript

【Javascript】軽量スクロールアニメーションのJavaScriptライブラリMoveTo

March 25, 2017
moveto

MoveToは軽量のスムーズにスクロールするJavaScriptライブラリ

Usage

const moveTo = new MoveTo();

const target = document.getElementById('target');

moveTo.move(target);

// or register a trigger

const trigger = document.getElementsByClassName('js-trigger')[0];

moveTo.registerTrigger(trigger);

Trigger HTML markup

<a href="#target" class="js-trigger" data-mt-duration="300">Trigger</a>

  <!-- or -->

  <button type="button" class="js-trigger" data-target="#target" data-mt-duration="300">Trigger</button>

Options

new MoveTo({
  tolerance: 0,
  duration: 800,
  easing: 'easeOutQuart'
})
Option Default
tolerance 0
duration 800
easing easeOutQuart
callback noop

Browser Support

Chrome, Firefox, Safari,IE10以上をサポート
MIT