2.16.3 • Published 6 years ago

rslider v2.16.3

Weekly downloads
276
License
WTFPL
Repository
github
Last release
6 years ago

🦄🌈


Simple, scalable slider for React mobx projects.

Install

$ npm install rslider --save

Make sure that all dependency packages is fetched and installed.

Styles

You can find styles for rSlider in: node_modules/rslider/rslider.css

API

PropetyDefault valueDescription
name'rSlider'Each rSlider must have unique name
className' 'Custom class that can be added to .rslider DOM element
style' 'Custom styles that can be added to .rslider DOM element
devModefalseAllow you to debug rSlider mobx model right from you slider
mediafalseAdd mediaQueries support to rSlider (See media usage example on the bottom)
customAnimationfalseAllow you to run css3 animations from https://daneden.github.io/animate.css or you own. (Only for slideToShow === 1)
currentStep0You can start rSlider from any slide you want
itemsShow1Number of rSlider items that will be shown on the same time
itemsScroll1Number of rSlider items that will be scroll on each step change
infinitytruerSlider has infinity loop as default
draggablefalserSlider can be draggable (except cases, when customAnimation === true)
draggableSensitivity10Only for enabled infinity mode. You can set any value from 0 to 100. The more draggableSensitivity, the more difficult to drag the slider to the next step
autoPlayfalseAllow you slide change step on each 7000ms. Can be customized inside rSliderItem component. See examples below
onReady(slider)=>{}Callback, that fire right after rSlider rendered
onStepChange(slider)=>{}Callback, that fire right after rSlider step changes. Returns rSlider model as first argument
onDragEnd(slider,draggable)=>{}Callback, that fire right after rSlider drag event ends. Returns rSlider model as first argument and draggable state object as the second
stickOut0Allows you to show some part of the next slide. That number converts in pixels
stopOnHoverfalseAllows you to stop rSlider autoplay on mouseover event (works only if autoPlay enabled)

Usage

  • Controls
  • Pagination
    import rSlider from 'rslider';
    const {RSlider, RSliderArrowL, RSliderArrowR, RSliderItems, RSliderPagination} = rSlider;
    
    <RSlider name="example1">
        <RSliderItems>
            <div>item 1</div>
            <div>item 2</div>
        </RSliderItems>

        <RSliderArrowL />
        <RSliderArrowR />
        <RSliderPagination />
    </RSlider>

  • autoPlay
  • custom itemsShow count
  • custom itemsScroll count
    <RSlider name="example2"
             itemsShow="2"
             itemsScroll={2}>
        <RSliderItems>
            <div>item 1</div>
            <div>item 2</div>
        </RSliderItems>
    </RSlider>

  • draggable
  • custom style
  • custom className
    <RSlider name="example3"
             draggable
             className="example-class-name"
             style={{ background: 'lightgray' }}>
        <RSliderItems>
            <div>item 1</div>
            <div>item 2</div>
        </RSliderItems>
    </RSlider>

    <RSlider name="example4"
             customAnimation='fadeOutUp_fadeInDown'>
        <RSliderItems>
            <div>item 1</div>
            <div>item 2</div>
        </RSliderItems>
        <RSliderArrowL onClick={ ()=> console.log('arrowL clicked!') } />
        <RSliderArrowR onClick={ ()=> console.log('arrowR clicked!') } />
    </RSlider>

  • development mode on
  • media
    • from 0 to 499px default settings + background: 'red'
    • from 500 to 999 - itemsShow = 2, itemsScroll = 2, background = 'green'
    • from 1000 - itemsShow = 3, itemsScroll = 3, background = 'violet'
<RSlider name="example5"
         devMode
         style={{ background: 'red' }}
         media={{
            [`*500`]: {
                itemsShow: 2,
                itemsScroll: 2,
                style: { background: 'green' }
            },
            ['500*1000']: {
                itemsShow: 3,
                itemsScroll: 3,
                style: { background: 'violet' }
            }
         }}>
    <RSliderItems style={{ textAlign: 'center' }}>
        <p>1</p>
        <p>2</p>
        <p>3</p>
    </RSliderItems>

    <RSliderArrowL />
    <RSliderArrowR />
</RSlider>

  • autoPlay
    • custom autoPlay duration for slide 2, 3
  • deep nested Arrow left control
    <RSlider name="example6"
             autoPlay>
        <RSliderItems>
            <div>item 1</div>
            <div data-duration={1000}>item 2</div>
            <div data-duration={6700}>item 3</div>
        </RSliderItems>
        <div>
             <RSliderArrowL />
        </div>

    </RSlider>
2.16.3

6 years ago

2.16.2

6 years ago

2.16.1

6 years ago

2.16.0

6 years ago

2.15.23

6 years ago

2.15.22

6 years ago

2.15.21

6 years ago

2.15.12

6 years ago

2.15.11

6 years ago

2.15.10

6 years ago

2.15.9

6 years ago

2.15.8

6 years ago

2.15.7

6 years ago

2.15.5

6 years ago

2.15.4

6 years ago

2.15.3

6 years ago

2.15.2

6 years ago

2.15.1

6 years ago

2.15.0

6 years ago

2.14.6

6 years ago

2.14.5

6 years ago

2.14.4

6 years ago

2.14.3

6 years ago

2.14.2

6 years ago

2.14.1

6 years ago

2.14.0

6 years ago

2.12.20

6 years ago

2.12.19

6 years ago

2.12.18

6 years ago

2.12.17

6 years ago

2.12.16

6 years ago

2.12.15

6 years ago

2.12.14

6 years ago

2.12.12

6 years ago

2.12.11

6 years ago

2.12.10

6 years ago

2.12.9

6 years ago

2.12.8

6 years ago

2.12.7

6 years ago

2.12.6

6 years ago

2.12.4

6 years ago

2.12.3

6 years ago

2.12.2

6 years ago

2.12.1

6 years ago

2.12.0

6 years ago

2.11.3

6 years ago

2.11.2

6 years ago

2.11.1

6 years ago

2.11.0

6 years ago

2.10.7

6 years ago

2.10.6

6 years ago

2.10.5

6 years ago

2.10.4

6 years ago

2.10.3

6 years ago

2.10.2

6 years ago

2.10.1

6 years ago

2.10.0

6 years ago

2.9.5

6 years ago

2.9.3

6 years ago

2.9.2

6 years ago

2.9.1

6 years ago

2.8.0

6 years ago

2.7.1

6 years ago

2.6.0

6 years ago

2.5.0

6 years ago

2.4.0

6 years ago

2.3.0

6 years ago

2.2.1

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.17

6 years ago

2.0.16

6 years ago

2.0.15

6 years ago

2.0.14

6 years ago

2.0.13

6 years ago

2.0.12

6 years ago

2.0.11

6 years ago

2.0.10

6 years ago

2.0.9

6 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

7 years ago

1.3.92

7 years ago

1.3.91

7 years ago

1.3.9

7 years ago

1.3.8

7 years ago

1.3.7

7 years ago

1.3.6

7 years ago

1.3.5

7 years ago

1.3.4

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.33

7 years ago

1.2.32

7 years ago

1.2.31

7 years ago

1.2.30

7 years ago

1.2.29

7 years ago

1.2.28

7 years ago

1.2.27

7 years ago

1.2.26

7 years ago

1.2.25

7 years ago

1.2.24

7 years ago

1.2.23

7 years ago

1.2.22

7 years ago

1.2.20

7 years ago

1.2.21

7 years ago

1.2.19

7 years ago

1.2.18

7 years ago

1.2.17

7 years ago

1.2.16

7 years ago

1.2.15

7 years ago

1.2.14

7 years ago

1.2.13

7 years ago

1.2.12

7 years ago

1.2.11

7 years ago

1.2.9

7 years ago

1.2.8

7 years ago

1.2.7

7 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago