File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ function Slider(options) {
3
3
wrap : options . wrap ,
4
4
inner : options . inner ,
5
5
dots : options . dots ,
6
- speed : options . speed
6
+ speed : options . speed ,
7
+ auto : options . auto
7
8
}
8
9
9
10
this . $slider = document . querySelector ( options . wrap ) ;
@@ -13,6 +14,8 @@ function Slider(options) {
13
14
this . resize ( ) ;
14
15
15
16
this . runScroll ( ) ;
17
+
18
+ this . autoScroll ( ) ;
16
19
}
17
20
18
21
Slider . prototype = {
@@ -81,12 +84,25 @@ Slider.prototype = {
81
84
}
82
85
}
83
86
} ) ;
87
+ } ,
88
+ autoScroll : function ( ) {
89
+ if ( ! this . options . auto ) {
90
+ return
91
+ }
92
+ var that = this ;
93
+ console . log ( that . slider )
94
+ var page = that . slider . getCurrentPage ( ) . pageX ;
95
+
96
+ setInterval ( function ( ) {
97
+ that . slider . next ( )
98
+ } , this . options . auto )
84
99
}
85
100
}
86
101
87
102
new Slider ( {
88
103
wrap : '#slider' ,
89
104
inner : '.content' ,
90
105
dots : '.dots' ,
91
- speed : 400
106
+ speed : 400 ,
107
+ auto : 2000
92
108
} ) ;
You can’t perform that action at this time.
0 commit comments