You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello @sami616,
This slider is small component I wrote year ago, and I'm actively working on it.
But you can make simple slideshow - set a timer and update selected prop that you are passing to the slider component.
Something like this:
// Parent componentexportdefaultclassParentSlideshowextendsComponent{constructor(){super();this.state={selected: 0,};}componentDidMount(){constSLIDES_COUNT=5;this.intervalID=setInterval(()=>{const{ selected }=this.state;this.setState({// Set the next slide, and make sure we return to zero// when selected is larger than SLIDES_COUNTselected: selected+1%SLIDES_COUNT,});},1000);}componentWillUnmount(){// clear intervalclearInterval(this.intervalID);this.intervalID=null;}render(){const{ selected }=this.state;return(<Sliderloop={true}showNav={false}selected={selected}><divstyle={{background: '#21BB9A'}}>A</div><divstyle={{background: '#329ADD'}}>B</div><divstyle={{background: '#9A5CB9'}}>C</div><divstyle={{background: '#E64C3C'}}>D</div><divstyle={{background: '#2D3F52'}}>E</div></Slider>);}}
Not an issue per se, but is there a simple way to introduce an autoplay feature?
The text was updated successfully, but these errors were encountered: