react-carousel-comp
A light-weight React react-carousel-comp component with extremely easy API(只适用于移动端项目). Online Demo, welcome code review
Installation
npm install react-carousel-comp --save
Usage
;;;;;; // 屏幕宽度const screenWidth = windowscreenwidth || documentdocumentElementclientWidth || documentbodyclientWidth; const SOURCE = img1 img2 img3 img4 img5; { return <div className="container"> <Carousel index=1 timer=5000 width=screenWidth infinite=true className="carousel" > SOURCE </Carousel> </div> ; }
props
param | detail | type | default |
---|---|---|---|
children | collection of child nodes, | array | [] |
width | components width, isRequiored | number | |
className | components className, isRequiored | string | |
style | components style | object | null |
index | display the index in the children when initializing, starting from 1 | number | 1 |
timer | carousel time | number | 4000 |
infinite | whether to loop | bool | true |
speed | speed of animation | number | 10 |
indicatorClass | indicator className | string | '' |
visibleIndicator | whether to display the indicator | bool | true |