How to use shuffle-text - 1 common examples

To help you get started, we’ve selected a few shuffle-text examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ics-ikeda / shuffle-text / examples / webpack / src / main.js View on Github external
function init() {
  var effectList = [];
  var elementList = document.querySelectorAll('.my-effect');

  for (var i = 0; i < elementList.length; i++) {

    var element = elementList[i];
    element.dataset.index = i;

    // インスタンスを取得する
    effectList[i] = new ShuffleText(element);

    // マウスオーバー時に再生する
    element.addEventListener('mouseenter', function () {
      effectList[+this.dataset.index].start();
    });

    // マウスアウト時に再生する
    element.addEventListener('mouseleave', function () {
      effectList[+this.dataset.index].start();
    });

    // 初回を再生する
    effectList[i].start();
  }
}

shuffle-text

This is the JavaScript library for text effect such as Flash contents.

MIT
Latest version published 5 months ago

Package Health Score

59 / 100
Full package analysis

Popular shuffle-text functions