0.1.8 • Published 3 years ago

react-moving-slider v0.1.8

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

React Moving Slider

A simple React component that displays your images using CSS animations and transitions.

It supports click events for sliding and moving through an array of images.

Demo here

React Moving Slider Example

Installation

run npm install react-moving-slider and then, in your component import MovingSlider from 'react-moving-slider'

Usage

The basic setup for a slider is

import React from "react"
import MovingSlider from 'react-moving-slider'

function App() {
  return (
    <MovingSlider
        images={[
            "https://picsum.photos/1200/1500?random=1",
            "https://picsum.photos/1200/1500?random=2",
            "https://picsum.photos/1200/1500?random=3",
        ]}
    />
  )
}

You can of course change the array values to be your images URLs

Options

Option NameTypeDescriptionDefault ValueRequired
minHeightnumberthe minimal height that one column can reach (in percentage and relative to the parent container)20No
maxHeightnumberthe maximal height that one column can reach (in percentage and relative to the parent container)100No
imagesArraythe array of images to be passed as "background-image" value, if more than 1 is provided, the handleSlide method will handle the transition between images on click[]Yes
numColumnsnumberthe number of columns to be displayed as div with the background fixed image30No
smartphoneNumColumnsnumberthe number of columns to be displayed as div with the background fixed image on a smartphone screen15No
fixedHeightnumberIf provided, the slider will ignore it's parent height and will use this value in pixels instednullNo
fixedWidthnumberIf provided, the slider will ignore it's parent width and will use this value in pixels instednullNo
speednumberThe speed of the looped animation in seconds3No
0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.0

3 years ago