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

slidemanager

v1.2.0

Published

Slider manager 💫 Focused on animations

Downloads

41

Readme

👨🏼‍🔧 Slidemanager

npm bundlephobia NpmLicense

Simple slide manager 💫 Focused on animations.

Installation

npm add slidemanager

Usage

import Slidemanager from 'slidemanager'

const slider = new Slidemanager({
  el: document.querySelector('#gallery'),
  callback({ current, previous, direction, done }) {
    // Your animations here
    // ...

    // Call done() when your animation is complete
    done()
  }
})

Parameters

Options

  • 🖼 el : DOM element to attach the swipe event to. If not given, please provide a length parameter.
  • ℹ️ callback : function called when user swipes or slide changes automatically.
  • 🔄  loop : whether to stop at the last / first slide or not. (Default false)
  • ▶️  auto : set it to true to automatically switch to the next slide. (Default false)
  • interval : specifies the interval in seconds between each slide change. auto must be true. (Default 5)
  • ↕️  vertical : if set to true, the swipe movement to change the current slide will need to be vertical. (Default false)
  • 🔢 length : number of slides. If not given, The number of slides will be the number of el's children
  • *️⃣  swipe : if false, the swipe touch movement detection is disabled. (Default true)
  • 🈁 mouseSwipe : Whether the swipe movement must be checked on the mouse or not. (Default false)
  • 🔀  random : Switch to random slides instead of next and previous ones. Enables automatically the loop option. (Default false)
  • #️⃣  startAt : The index from which to start the slider on initialization. (Default 0)
  • threshold : Amount of pixels required to change slide when swiping (Default 60)
  • init : Whether to init the manager immediately or not. If false, call the .init() method to initialize the manager. (Default true)

Methods

  • 👈 prev() : goes to the previous slide
  • 👉 next() : goes to the next slide
  • 🚗 goTo(index, data) : goes to the specified index, you can pass data which can be recovered in the callback
  • 🚦 start() / stop() : starts / stops the automatic sliding
  • 🛠 init() : adds event listeners. Call this when the init option is set to false
  • ⚰️ destroy() : removes event listeners and stops the slider

Callback

The callback function receives a parameter containing the following properties :

  • current : New index
  • previous : Previous index
  • direction : 1 for next, -1 for previous
  • done : the function to call when you're done with your animations
  • data : some data that may be given from a call to goTo()

Instance properties

The returned Slidemanager instance exposes the following properties :

  • index : The current index
  • max : The last element's index
  • changing : Whether the slider is currently moving or not

License

MIT, see LICENSE.md for details.