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

css3slider

v3.0.2

Published

Create simple horizontal slider using only css3 transitions

Downloads

14

Readme

CSS3Slider

Create simple horizontal slider using only css3 transitions

Why should you use it?

The simple horizontal slider is a well known pattern, that can be observed in various kinds on thousands of websites. There are a lot of frameworks out there, that provide all kinds of slider experiences, but most of them are pretty bloated and offer more functions than most of us need. This is where the CSS3Slider comes im place. With the CSS3Slider you can create simple slider that are responsive and offer a simple but nice sliding animation.

Installing

Currently there is only one way to install the CSS3Slider, using NPM:

$ npm install css3slider

How to use

First you need to require the CSS3Slider:

var CSS3Slider = require('css3slider');

In order to use the CSS3Slider you will need to create a new CSS3Slider Object in your script:

var mySliderObject = new CSS3Slider(htmlNode, configObject);

You need to pass two params to the CSS3Slider:

  • The htmlNode that you want to work as a slider - mandatory
  • An options object you can use, to customize your slider - optional

The Options

In order to customize your CSS3Slider, you pass an options object to it. Valid options are listed below:

  • maxSteps - you can config how many steps the slider will slide in a single slide attempt - default is 1
  • forceSingleElement - if you use the slider to slide image galleries, where every image is 100% viewport of the slider, you can manualy force the CSS3Slider to only display one slider element per time - default is false
  • cloneMode - with cloneMode true, CSS3Slider will add clones before the first child element and after the last child element, to create the illusion of an endless slider - default is false
  • continiousSlide - with continiousSlide true, CSS3Slider will bring you back to the start if you reach the last child element. If cloneMode is also true, CSS3Slider will create an endless slider - default is false
  • overflowAllowed - with overflowAllowed true, the CSS3Slider allow to slide to the last element even there are more than one element visible - default is false

API

The CSS3Slider will not create any kind of controll elements or arrows to slide your content. It is totaly up to you, to create those elements and then call the CSS3Slider methods when needed. The benefit to this is, that you can totaly customize your UI to your needs. You can even slide your contents from other moduls or use touch frameworks like Hammer to access your slider.

How to slide

mySliderObject.slideLeft();

A simple slide to the left side.

mySliderObject.slideRight();

A simple slide to the right side.

mySliderObject.slideTo(index);

Slide to a specific position inside the slider elements. Lets say you have a row of 6 teasers, than you can slide directly to teaser 5 using

mySliderObject.slideTo(4);

Might come in handy

CSS3Slider offers some additional methods you can use to create your own slider.

mySliderObject.isAnimationAllowed();

Check if the CSS3Slider will accept a new slide attempt. If this returns false, the CSS3Slider is currently busy.

mySliderObject.updateBaseConfig();

You can use this method to update the CSS3Slider. This can be usefull if you add new child elements to the slider, or after a resize event.

mySliderObject.deactivate();

If you want to deactivate the CSS3Slider, you can do this with the deactivate method.

mySliderObject.reactivate();

To reactivate a former deactivated CSS3Slider, use the reactivate method.

mySliderObject.slidesAvailable(direction);

Will return the count of child elements in the given direction, beginning from the current slider position. Valid directions are left and right.

mySliderObject.getRuntimeConfig();

This returns the runtime config object. The runtime config object stores several informations that describe the current state of your CSS3Slider:

  • slidePosition - the current first visible element in the row
  • slideValue - the offset of the row in percent
  • slideChildrenCount - how many non clone elements are in the slider
  • slideChildrenVisible - how many elements are visible at once in the slider
  • slideOverflowCount - how many overflow steps are possible
  • slideClonesCount - how many clones are needed

Authors

  • Axel Güldner@infomax - all the work