File tree 2 files changed +45
-0
lines changed
2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import UnevenSetsFinite from '../examples/UnevenSetsFinite'
12
12
import CenterMode from '../examples/CenterMode'
13
13
import FocusOnSelect from '../examples/FocusOnSelect'
14
14
import AutoPlay from '../examples/AutoPlay'
15
+ import AutoPlayMethods from '../examples/AutoPlayMethods'
15
16
import PauseOnHover from '../examples/PauseOnHover'
16
17
import Rtl from '../examples/Rtl'
17
18
import VariableWidth from '../examples/VariableWidth'
@@ -40,6 +41,7 @@ export default class App extends React.Component {
40
41
< CenterMode />
41
42
< FocusOnSelect />
42
43
< AutoPlay />
44
+ < AutoPlayMethods />
43
45
< PauseOnHover />
44
46
< Rtl />
45
47
< VariableWidth />
Original file line number Diff line number Diff line change
1
+ import React , { Component } from 'react'
2
+ import Slider from '../src/slider'
3
+
4
+ export default class AutoPlayMethods extends Component {
5
+ constructor ( props ) {
6
+ super ( props )
7
+ this . play = this . play . bind ( this )
8
+ this . pause = this . pause . bind ( this )
9
+ }
10
+ play ( ) {
11
+ this . slider . slickPlay ( )
12
+ }
13
+ pause ( ) {
14
+ this . slider . slickPause ( )
15
+ }
16
+ render ( ) {
17
+ const settings = {
18
+ dots : true ,
19
+ infinite : true ,
20
+ slidesToShow : 3 ,
21
+ slidesToScroll : 1 ,
22
+ autoplay : true ,
23
+ autoplaySpeed : 2000
24
+ } ;
25
+ return (
26
+ < div >
27
+ < h2 > Auto Play & Pause with buttons </ h2 >
28
+ < Slider ref = { slider => this . slider = slider } { ...settings } >
29
+ < div > < h3 > 1</ h3 > </ div >
30
+ < div > < h3 > 2</ h3 > </ div >
31
+ < div > < h3 > 3</ h3 > </ div >
32
+ < div > < h3 > 4</ h3 > </ div >
33
+ < div > < h3 > 5</ h3 > </ div >
34
+ < div > < h3 > 6</ h3 > </ div >
35
+ </ Slider >
36
+ < div style = { { textAlign : 'center' } } >
37
+ < button className = 'button' onClick = { this . play } > Play</ button >
38
+ < button className = 'button' onClick = { this . pause } > Pause</ button >
39
+ </ div >
40
+ </ div >
41
+ ) ;
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments