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

active-slider

v1.0.2

Published

Library for CSS masters. Build whatever you need with the append active class

Downloads

2

Readme

Active Slider

Did you ever happen when trying to build a carousel slider with a js library, and lost control over your slider design?

Active-Slider will give you the freedom to build and design whatever you need by only adding an active class. By that, you are not limited to only building a slider, but you can also build cards or even 3D elements (Examples at the end of the page).

  • The Active Class - Active-Slider library has one job, adding an "active" class for your desired HTML tags.
  • Keep your HTML beautiful - Active Slider library will not inject HTML, CSS or JS code.
  • Full control - As a CSS master, you'll have full control over your slider with no injected Html or Css.

There is one rule, active-elements group must have the same number of elements. For example: .slide-image elements must have the same number of .bullet elements.

NPM

npm install active-slider
import ActiveSlider from 'active-slider';

new ActiveSlider({
    wrapper: '.slider-wrapper', 
    activeElements: ['.slide-image', '.bullet'],
}); 
<div class="slider-wrapper">
    
  <div>
    <img class="slide-image" src="https://bit.ly/2HrOv0p">
    <img class="slide-image" src="https://bit.ly/2SL9ccV">
    <img class="slide-image" src="https://bit.ly/38whADW">
  </div>
    
  <div>
    <div class="bullet"></div>
    <div class="bullet"></div>
    <div class="bullet"></div>
  </div>
    
</div>

Options

  • wrapper (string)(required) - Select the wrapper element. Example: '.slider'

  • activeElements (array|string)(required) - Select elements to add the active class. Example: ['.slide-image', '.bullet']

  • swipeArea (string)(optional) - Select the element that will be the swipe area. Example: '.slide-images-container'

  • clickableElements (array|string)(optional) - Add the active class to the clicked element. Example: '.bullet'

  • prevNextButtons (array)(optional) - Select the previous and next buttons. Example: ['.prev', '.next']

  • autoplay (boolean)(optional) - Is autoplay. Default: true

  • autoplaySpeed (number)(optional) - Autoplay duration in milliseconds. Default: 3500

  • stopAutoPlayOnClick (string|array)(optional) - Select the elements to be the listeners for the click event in order to stop the autoplay. Example: ['.prev', '.next']

  • loop (boolean)(optional) - Loop elements. Default: true

  • firstElementActive (boolean)(optional) - Set to false in order to remove the active class from the first elements as default. Default: true

Methods

Get more control with the object methods.

import ActiveSlider from 'active-slider';

var mySlider = new ActiveSlider({
    wrapper: '.slider-wrapper', 
    activeSlider: ['.slide-image', '.bullet'],
}); 

// Set the first element as active.
mySlider.first();

// Set the last element as active.
mySlider.last();

// Set the next element as active.
mySlider.next();

// Set the previous element as active.
mySlider.prev();

// Remove the active Class from all slides.
mySlider.removeAll();

// Start autoplay.
mySlider.autoplay();

// stop autoplay.
mySlider.stopAutoplay();

Examples

Slider - https://codepen.io/guycohen85/pen/GRJoxvw

Cards - https://codepen.io/guycohen85/pen/YzXqOPJ

Rubik's Cube - https://codepen.io/guycohen85/pen/MWwjwKO