npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

glider-autoplay

v1.1.2

Published

Autoplay utility for Glider.js

Downloads

125

Readme

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