Giter Club home page Giter Club logo

glider-autoplay's Introduction

glider-autoplay


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

glider-autoplay's People

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

stutilad mersmith

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.