1
1
# react-simple-image-slider
2
+
2
3
[ ![ ReactJs] [ react-image ]] [ react-url ]
3
4
[ ![ Download Count] [ download-image ]] [ download-url ]
4
5
[ ![ GitHub license] [ license-image ]] [ license-url ]
5
6
6
- [ react-image ] : https://img.shields.io/badge/ReactJS-%5E16.4.2 -blue.svg
7
+ [ react-image ] : https://img.shields.io/badge/ReactJS-%5E16.13.1 -blue.svg
7
8
[ react-url ] : https://reactjs.org
8
9
[ download-image ] : http://img.shields.io/npm/dm/react-simple-image-slider.svg?style=flat
9
10
[ download-url ] : http://www.npmjs.com/package/react-simple-image-slider
10
11
[ license-image ] : https://img.shields.io/badge/license-MIT-blue.svg
11
12
[ license-url ] : https://github.com/kimcoder/react-simple-image-slider/blob/master/LICENSE
12
13
13
14
Simple ImageSlider Component for ReactJS v16.13<br >
15
+
14
16
- Just Two Elements will be used. (for display images)
15
- - Support GPU Render, by default.
17
+ - Support GPU Render, by default.
16
18
- Support Image Preload.
17
19
- Selectable Navgation Styles.
18
20
19
- # Live demo
20
- - <a href =" https://kimcoder.github.io/demo/react-simple-image-slider/ " target =" _blank " >Go to Site</a ><br ><br >
21
- ![ demo gif] ( https://github.com/kimcoder/react-simple-image-slider/raw/master/demo.gif )
21
+ # Live demo
22
22
23
+ - <a href =" https://kimcoder.github.io/demo/react-simple-image-slider/ " target =" _blank " >Go to Site</a ><br ><br >
24
+ ![ demo gif] ( https://github.com/kimcoder/react-simple-image-slider/raw/master/demo.gif )
23
25
24
26
# Install
27
+
25
28
```
26
29
// npm
27
30
npm install react-simple-image-slider --save
@@ -31,69 +34,74 @@ yarn add react-simple-image-slider
31
34
```
32
35
33
36
# Usage
37
+
34
38
```
35
39
import SimpleImageSlider from "react-simple-image-slider";
36
40
37
- class App extends React.Component {
38
- render() {
39
- const images = [
40
- { url: "images/1.jpg" },
41
- { url: "images/2.jpg" },
42
- { url: "images/3.jpg" },
43
- { url: "images/4.jpg" },
44
- { url: "images/5.jpg" },
45
- { url: "images/6.jpg" },
46
- { url: "images/7.jpg" },
47
- ];
48
-
49
- return (
50
- <div>
51
- <SimpleImageSlider
52
- width={896}
53
- height={504}
54
- images={images}
55
- />
56
- </div>
57
- );
58
- }
41
+ const images = [
42
+ { url: "images/1.jpg" },
43
+ { url: "images/2.jpg" },
44
+ { url: "images/3.jpg" },
45
+ { url: "images/4.jpg" },
46
+ { url: "images/5.jpg" },
47
+ { url: "images/6.jpg" },
48
+ { url: "images/7.jpg" },
49
+ ];
50
+
51
+ const App = () => {
52
+ return (
53
+ <div>
54
+ <SimpleImageSlider
55
+ width={896}
56
+ height={504}
57
+ images={images}
58
+ />
59
+ </div>
60
+ );
59
61
}
60
62
```
63
+
61
64
If You want to see more detail source,<br >
62
- - [ ` example/App.jsx ` ] ( https://github.com/kimcoder/react-simple-image-slider/blob/master/example/App.jsx ) <br >
65
+
66
+ - [ ` example/App.tsx ` ] ( https://github.com/kimcoder/react-simple-image-slider/blob/master/example/App.tsx ) <br >
63
67
64
68
# Props
65
- | Name| Type| Required| Description| Default|
66
- | :--:| :--:| :-----:| :----------| :------|
67
- | ** width** | ` Number ` | ` Required ` | Image Slider Width||
68
- | ** height** | ` Number ` | ` Required ` | Image Slider Height||
69
- | ** images** | ` Array ` | ` Required ` | Images,<br >Array Elements should be like this structure,<br >{ url: "" }||
70
- | ** style** | ` String ` | ` Optional ` | css object||
71
- | ** slideDuration** | ` Number ` | ` Optional ` | css transition-duration property| ` 0.5 ` |
72
- | ** navStyle** | ` Number ` | ` Optional ` | Arrow Navgation Style,<br >1 or 2| ` 1 ` |
73
- | ** showNavs** | ` Boolean ` | ` Optional ` | Toggle Arrow Navgation| ` true ` |
74
- | ** showBullets** | ` Boolean ` | ` Optional ` | Toggle Bullets| ` true ` |
75
- | ** useGPURender** | ` Boolean ` | ` Optional ` | Toggle GPU Render| ` true ` |
76
- | ** bgColor** | ` String ` | ` Optional ` | slider container's css background-color property| ` #000000 ` |
77
- | ** onClick** | ` Function ` | ` Optional ` | Image Click Callback function,<br >` onClick = (idx, event) => { } ` <br >idx : number : clicked bullet index (begin from 0)||
78
- | ** onClickNav** | ` Function ` | ` Optional ` | Arrow Navigation Callback function,<br >` onClickNav = (toRight) => { } ` <br >toRight : Boolean : slide direction||
79
- | ** onClickBullets** | ` Function ` | ` Optional ` | Bullets Callback function,<br >` onClickBullets = (idx) => { } ` <br >idx : Number : clicked bullet index (begin from 0)||
80
- | ** onStartSlide** | ` Function ` | ` Optional ` | Slide Transition Start function,<br >` onStartSlide = (idx, length) => { } ` <br >idx : Number : start index (begin from 1)<br >length : Number : image length||
81
- | ** onCompleteSlide** | ` Function ` | ` Optional ` | Slide TransitionEnd Callback function,<br >` onCompleteSlide = (idx, length) => { } ` <br >idx : Number : start index (begin from 1)<br >length : Number : image length||
69
+
70
+ | Name | Type | Required | Description | Default |
71
+ | :-----------------: | :--------: | :--------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------- |
72
+ | ** width** | ` Number ` | ` Required ` | Image Slider Width | |
73
+ | ** height** | ` Number ` | ` Required ` | Image Slider Height | |
74
+ | ** images** | ` Array ` | ` Required ` | Images,<br >Array Elements should be like this structure,<br >{ url: "" } | |
75
+ | ** style** | ` String ` | ` Optional ` | css object | |
76
+ | ** slideDuration** | ` Number ` | ` Optional ` | css transition-duration property | ` 0.5 ` |
77
+ | ** navStyle** | ` Number ` | ` Optional ` | Arrow Navgation Style,<br >1 or 2 | ` 1 ` |
78
+ | ** showNavs** | ` Boolean ` | ` Optional ` | Toggle Arrow Navgation | ` true ` |
79
+ | ** showBullets** | ` Boolean ` | ` Optional ` | Toggle Bullets | ` true ` |
80
+ | ** useGPURender** | ` Boolean ` | ` Optional ` | Toggle GPU Render | ` true ` |
81
+ | ** bgColor** | ` String ` | ` Optional ` | slider container's css background-color property | ` #000000 ` |
82
+ | ** onClick** | ` Function ` | ` Optional ` | Image Click Callback function,<br >` onClick = (idx, event) => { } ` <br >idx : number : clicked bullet index (begin from 0) | |
83
+ | ** onClickNav** | ` Function ` | ` Optional ` | Arrow Navigation Callback function,<br >` onClickNav = (toRight) => { } ` <br >toRight : Boolean : slide direction | |
84
+ | ** onClickBullets** | ` Function ` | ` Optional ` | Bullets Callback function,<br >` onClickBullets = (idx) => { } ` <br >idx : Number : clicked bullet index (begin from 0) | |
85
+ | ** onStartSlide** | ` Function ` | ` Optional ` | Slide Transition Start function,<br >` onStartSlide = (idx, length) => { } ` <br >idx : Number : start index (begin from 1)<br >length : Number : image length | |
86
+ | ** onCompleteSlide** | ` Function ` | ` Optional ` | Slide TransitionEnd Callback function,<br >` onCompleteSlide = (idx, length) => { } ` <br >idx : Number : start index (begin from 1)<br >length : Number : image length | |
82
87
83
88
If You want to see more detail,<br >
84
- - [ ` src/ImageSliderPropTypes.js ` ] ( https://github.com/kimcoder/react-simple-image-slider/blob/master/src/ImageSliderPropTypes.js )
85
- - [ ` example/app.jsx ` ] ( https://github.com/kimcoder/react-simple-image-slider/blob/master/example/App.jsx ) <br >
89
+
90
+ - [ ` example/app.tsx ` ] ( https://github.com/kimcoder/react-simple-image-slider/blob/master/example/App.tsx ) <br >
86
91
87
92
# Development
93
+
88
94
### directory & source
89
- - `` ./example/ `` : demo site souce for testing component
90
- - `` ./src/ `` : image slider component source
91
- - `` ./dist/ `` : image slider component distribution
92
- - `` ./babelrc `` : babel configure. (version 7.x)
93
- - `` ./webpack.config.js `` : webpack configure. (version 4.x)
94
- - `` ./rollup.config.js `` : rollup configure.
95
+
96
+ - ` ./example/ ` : demo site souce for testing component
97
+ - ` ./src/ ` : image slider component source
98
+ - ` ./dist/ ` : image slider component distribution
99
+ - ` ./babelrc ` : babel configure. (version 7.x)
100
+ - ` ./webpack.config.js ` : webpack configure. (version 4.x)
101
+ - ` ./rollup.config.js ` : rollup configure.
95
102
96
103
### scripts
104
+
97
105
```
98
106
// npm
99
107
npm run example // run a test app(demo) by webpack dev server
@@ -105,10 +113,12 @@ yarn example
105
113
yarn build
106
114
yarn build:watch
107
115
```
116
+
108
117
If you want to run a test app, should build before do that.<br >
109
118
110
119
After run example by webpack dev server,<br >
111
- open `` http://localhost:8080/ ` ` in a browser<br >
120
+ open ` http://localhost:8080/ ` in a browser<br >
112
121
113
122
# License
114
- MIT
123
+
124
+ MIT
0 commit comments