0.4.3 • Published 4 years ago

tiny-slider-react-wrapper v0.4.3

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

tiny-slider-react

This is a fork of tiny-slider-react Original plugin tiny-slider

UPDATED: Removed call to componentWillReceiveProps

demo

props

propdecription
settingsoptions slider
onClickcallback to return slide clicked (slideClicked, info, event)
startIndexindex of carousel initiation
onIndexChangedevent bind
onTransitionStartevent bind
onTransitionEndevent bind
onTouchStartevent bind
onTouchMoveevent bind
onTouchEndevent bindd
import TinySliderWrapper from "tiny-slider-react-wrapper";

const settings = {
  lazyload: true,
  nav: false,
  mouseDrag: true
};

<TinySliderWrapper settings={settings}>
    {imgs.map((el, index) => (
      <div key={index} style={{ position: "relative" }}>
        <img
          className={`tns-lazy-img`}
          src={loadingImage}
          data-src={el}
          alt=""
          style={imgStyles}
        />
      </div>
    ))}
</TinySliderWrapper>

How to use external buttons for prev & next

const settings = {
  lazyload: true,
  nav: false,
  mouseDrag: true,
  controls: false // remove built-in nav buttons
}

Add onClick for your buttons:

<button type="button" onClick={() => this.onGoTo('prev')}>Previous</button>
<button type="button" onClick={() =>  this.onGoTo('next')}>Next</button>

Add the handler on your component:

onGoTo = dir => this.ts.slider.goTo(dir)