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

react-animated-slider-2

v1.1.5

Published

Animated slider component for react

Downloads

2

Readme

react-animated-slider

npm version downloads Greenkeeper badge CircleCI dependencies devDependencies

A Slider/Carousel component for React supporting custom css animations.

Demo - Codesandbox Playground

Preview

Features:

  • Ready to use slider component with animations
  • Easy customization
  • Horizontal or vertical navigation
  • Swipe navigation on touch devices
  • Infinite slider
  • Autoplay
  • Supports any element as children
  • Clean DOM without dirty manipulations
  • Support for CSS modules
  • Works with SSR
  • Works on IE11

Install:

npm install react-animated-slider --save

Most Simple Use:

import Slider from 'react-animated-slider';
import 'react-animated-slider/build/horizontal.css';

<Slider>
  {content.map((article, index) => <div key={index}>
    <h2>{article.title}</h2>
    <div>{article.description}</div>
  </div>)}
</Slider>

Properties:

slideIndex - number, default 0

Index of the slide that will be initially displayed.

duration - number, default 2000(ms)

Duration of the animation in milliseconds. It is used to remove the animateIn and animateOut classNames and assign current after the transition has completed.

disabled - boolean, default false

Disable slider navigation

infinite - boolean, default true

Enable or disable infinite loop through slides. Sliders with only 2 children will have this option set to false

autoplay - number, default undefined

Autoplay interval in miliseconds. If undefined the slider will not play automatically. The timer will be paused and reset during user interactions such as mouse over or touch, to avoid sliding away the elements when the user wants to click them.

touchDisabled boolean, default false

Disable slider navigation through touch events

minSwipeOffset - number, default 15(px)

Minimum distance to swipe for triggering a navigation event

previousButton - ReactElement, default is an arrow svg

Will be rendered inside the previous button

nextButton - ReactElement, default is an arrow svg

Will be rendered inside the next button

onSlideChange - function, called after the current slide has changed; receives an object with the new slide index as argument:

<Slider onSlideChange={event => console.log(event.slideIndex)}>

classNames object, default

{
  slider: 'slider',
  previousButton: 'previousButton',
  nextButton: 'nextButton',
  buttonDisabled: 'disabled',
  track: 'track',
  slide: 'slide',
  hidden: 'hidden',
  previous: 'previous',
  current: 'current',
  next: 'next',
  animateIn: 'animateIn',
  animateOut: 'animateOut',
}

Object representing the CSS classNames that will be apllied to the slides.

Classnames

slider the classname for the whole Slider element

previousButton previous button

nextButton next button

buttonDisabled disabled state for previous and next button

track element wrapping all slides

slide apllied to every item (child)

hidden a slide that is not visible and is not adjacent to the current slide, therefore no animation will be usually needed

previous the slide that will appear or is appearing when the slider navigated back

next the slide that will appear or is appearing when the slider navigated forward

animateIn the slide moving into the view

animateOut the slide moving out of the view