glider-autoplay
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

glider-autoplay


English Русский

Autoplay utility for Glider.js

See example in index.html

Copy file glider-autoplay.min.js and include to your html

<script src="glider-autoplay.min.js"></script>

Or install with npm

npm i glider-autoplay
import { gliderAutoplay } from "glider-autoplay";

Usage

gliderAutoplay(new Glider(/* see glider-js docs*/), {
    interval, // int, required
    pausable, // boolean, default true
    onPause,
    onRestart,
    startItem, // default 0
});

interval - interval between slides in milliseconds;
pausable - autoplay will be stopped onMouseEnter and rerun onMouseLeave when true
onPause - callback function to be called when autoplay stopped
onRestart - callback function to be called when autoplay run
startItem - glider item with which autoplay will start


Methods

pause()

const gliderInstance = new Glider(/* see glider-js docs*/);
gliderAutoplay(gliderInstance, { interval: 3000 });
gliderInstance.pause();

run()

const gliderInstance = new Glider(/* see glider-js docs*/);
gliderAutoplay(gliderInstance, { interval: 3000 });
gliderInstance.run();

Properties

isRunning - boolean readonly

const gliderInstance = new Glider(/* see glider-js docs*/);
gliderAutoplay(gliderInstance, { interval: 3000 });
console.log(gliderInstance.isRunning); // true

gliderInstance.pause();
console.log(gliderInstance.isRunning); // false

gliderInstance.run();
console.log(gliderInstance.isRunning); // true

Утилита автовоспроизведения для Glider.js

Смотрите пример в index.html

Скопируйте файл glider-autoplay.min.js и подключите его к html

<script src="glider-autoplay.min.js"></script>

Или установите в npm

npm i glider-autoplay
import { gliderAutoplay } from "glider-autoplay";

Использование

gliderAutoplay(
  new Glider(/* смотрите документацию glider-js* /),
  {
    interval, // целое число, обязательное свойство
    pausable, // логический тип, по умолчанию true
    onPause,
    onRestart,
    startItem // по умолчанию 0
  }
);

interval - интервал между слайдами в милисекундах;
pausable - приостанавливать воспроизведение при наведении курсора мыши и возобновлять, когда мышь покидает область
onPause - колбэк, сработает когда воспроизведение будет приостановлено
onRestart - колбэк, сработает когда воспроизведение будет возобновлено
startItem - индекс слайда с которого будет начато воспроизведение


Методы

pause()

const gliderInstance = new Glider(/* see glider-js docs*/);
gliderAutoplay(gliderInstance, { interval: 3000 });
gliderInstance.pause();

run()

const gliderInstance = new Glider(/* see glider-js docs*/);
gliderAutoplay(gliderInstance, { interval: 3000 });
gliderInstance.run();

Свойства

isRunning - логический тип только для чтения

const gliderInstance = new Glider(/* see glider-js docs*/);
gliderAutoplay(gliderInstance, { interval: 3000 });
console.log(gliderInstance.isRunning); // true

gliderInstance.pause();
console.log(gliderInstance.isRunning); // false

gliderInstance.run();
console.log(gliderInstance.isRunning); // true

Readme

Keywords

Package Sidebar

Install

npm i glider-autoplay

Weekly Downloads

29

Version

1.1.1

License

MIT

Unpacked Size

8.83 kB

Total Files

5

Last publish

Collaborators

  • alexanderdemidenko