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 🙏

© 2026 – Pkg Stats / Ryan Hefner

matfin-slider

v2.0.1

Published

"Responsive slider/swiper written in Vanilla JS."

Readme

Responsive Slider package

About

This is a simple slider plugin written in vanilla Javascript that is designed to be lightweight, fast and responsive.

Installation

This package is published on NPMJS and Yarn and can be installed with either package management tool.

To install via NPM:

$ cd /my-project-root
$ npm install matfin-slider

To install via Yarn:

$ cd /my-project-root
$ yarn add matfin-slider

This package has been written in Vanilla Javascript (ES2015) and is transpiled to ES5 using babel. The set up is as follows:

  • _src/slider.js is the source code written in ES2015.
  • dist/slider.js is the transpiled version unminified and converted to use the ES5 syntax of JS.
  • dist/slider.min.js is the transpiled and minified version of the code.

Usage

To use this package directly, simply include it as a script in your html source as follows:

<script src="bower_components/matfin-slider/_dist/slider.js">
</script>

You will then need to set up the html for your slider as follows:

<div class="slider">
	<div class="slides" style="width: 300%">
		<img src="this/is/slide/one.jpg" />
		<img src="this/is/slide/two.jpg" />
		<img src="this/is/slide/three.jpg" />
	</div>
</div>

The following CSS should apply:

.slider {
	position: relative;
	overflow: hidden;
	transform: translate3d(0px, 0px, 0px);
}

.slider .slides {
	display: flex;
}

.slider .slides img {
	flex: 1
}

You will then need to add the following to your Javascript source:

/**
 *	To set up all sliders on a page.
 */
onload = () => {
	let nodes = document.querySelectorAll('.slider');
	nodes.forEach((node) => {
		new Slider().setup(node);
	});
};
/**
 *	To target an individual slider for set up.
 */
onload = () => {
	let node 	= document.querySelector('.slider'),
		slider 	= new Slider().setup(node);
};

Events can also be dispatched as needed:


onload = () => {
	
	let node 	= document.querySelector('.slider'),
		slider 	= new Slider().setup(node);

	/**
	 *	This is fired when the slider has been let go.
	 */
	node.addEventListener('sliderdrop', (e) => {
		console.log(e);
		// your code here...
	});

	/**
	 *	This is fired when the slider animation has completed.
	 */
	node.addEventListener('slidecomplete', (e) => {
		console.log(e);
		// your code here...
	});

	/**
	 *	This is fired when the slider has reached the beginning or the end.
	 */
	node.addEventListener('sliderboundsreached', (e) => {
		console.log(e);
		// your code here...
	});

};

Note:

When setting the width for the slide container (.slides), you need to set this as 100% multiplied by the number of slides inside slides.

The immediate children of .slides are regarded as a single slide.

If you wanted to caclulate the number of slides correctly and apply the width style using Javascript, you could do as follows:

onload = () => {
	let slide_nodes = document.querySelectorAll('.slides');

	slide_nodes.forEach((slide_node) => {
		let count_children 		= slide_node.children.length;
		slide_node.style.width 	= `${count_children * 100}%`;
	});
};

Features

  • Fully responsive, meaning it will work on mobile and tablet devices just as well as desktop devices.
  • Touch support, meaning the slider responds to touch events if supported, or normal mouse events.
  • Responds well to window resize events and recalibrates itself.
  • Makes use of requestAnimationFrame for smoother transitions.
  • Fires custom events, so you can write your own code to handle these.

Support

  • This plugin has been tested to work on the latest versions of most modern browsers, including the following

    • Internet Explorer
    • Microsoft Edge
    • Safari (Desktop and iOS)
    • Firefox
    • Chrome (Desktop and Android)
    • Opera
  • The following browsers are not fully supported so you may encounter issies with them.

    • Internet Explorer 10
    • Default Android Browser

Troubleshooting

If you spot any issues, please add them to the issue tracker of this repository with the following information:

  • Browser/Platform name and version number
  • Description of what you would expect to be happening
  • Description of what is actually happening
  • Optional example repository illustrating the issue