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

slydesho

v0.1.3

Published

Little slideshow manager

Downloads

17

Readme

slydeSho

npm install slydesho

A handy little utility to build a slideshows. Library agnostic. Doesn't preform any DOM manipulation, basically just keeps track of your slides and provides handy events to hook onto.

Setup

var Slydesho = require('slydesho');

var slides = Slydesho({
	blocks : $('[data-blocks]'),
	delay : 1500
});

Require Slydesho. Create a new instance and pass an array of elements you want to keep track of in the options. This example is using jQuery to create that array. In the documentation below we'll be referring to slides as the namespace, but you can call this anything you like.

Example slideshow

Here’s a quick demonstration of how to build a rudimentary slideshow using the block:on and block:off events. The data associated with the block is passed through the first argument of the function.

slides.on('block:on', function(data) {
	$(data.block).css('display', 'block');
});

slides.on('block:off', function(data) {
	$(data.block).css('display', 'none');
});

slides.start();

Custom loops

It's possible to define a custom loop by using the Loop helper. I find this useful for defining custom delays based upon attributes on the block element. You could store the timeout in your own implimentation, but the method below lets you utilize the pre-baked stop and pause methods.

slides.on('block:on', function() {

    // Data and element cache
    var $block = $(_data.block);
    var _delay = 500;

    // Custom delay
    if ( $block.is('[data-slide-delay]') ) {
        _delay = parseInt($block.attr('data-slide-delay'));
    }

    // Progress
    slideshow.loop = setTimeout(slideshow.progress, _delay);

});

With this example we set the delay option to false which disables the built-in loop interval when calling .start().

Events

Events can be set like so:

slides.on('progress', callback);
slides.once('progress', callback);
slides.off('progress', callback);

Available events:

block:on        Block is activated
block:off       Block is deactivated
progress        Slideshow has progressed

Methods

Methods can be invoked like so:

slides.start();

Available methods:

start           Start the slideshow
stop            Stop the slideshow