@@ -103,6 +103,7 @@ export class Manager extends Component {
103103 autoplay : PropTypes . bool ,
104104 autoplayDuration : PropTypes . number ,
105105 autoplayLoop : PropTypes . bool ,
106+ autoplayOnStart : PropTypes . bool ,
106107 children : PropTypes . node ,
107108 contentHeight : PropTypes . number ,
108109 contentWidth : PropTypes . number ,
@@ -139,6 +140,7 @@ export class Manager extends Component {
139140 autoplay : false ,
140141 autoplayDuration : 7000 ,
141142 autoplayLoop : true ,
143+ autoplayOnStart : true ,
142144 contentWidth : 1000 ,
143145 contentHeight : 700 ,
144146 disableKeyboardControls : false ,
@@ -167,7 +169,7 @@ export class Manager extends Component {
167169 slideReference : [ ] ,
168170 fullscreen : window . innerHeight === screen . height ,
169171 mobile : window . innerWidth < props . contentWidth ,
170- autoplaying : props . autoplay
172+ autoplaying : props . autoplay ? props . autoplayOnStart : false
171173 } ;
172174
173175 this . viewedIndexes = new Set ( ) ;
@@ -188,11 +190,14 @@ export class Manager extends Component {
188190
189191 componentDidMount ( ) {
190192 const slideIndex = this . _getSlideIndex ( ) ;
193+ const autoplayOnStart = this . props . autoplay
194+ ? this . props . autoplayOnStart
195+ : false ;
191196 this . setState ( {
192197 lastSlideIndex : slideIndex
193198 } ) ;
194199 this . _attachEvents ( ) ;
195- if ( this . props . autoplay ) {
200+ if ( autoplayOnStart ) {
196201 this . _startAutoplay ( ) ;
197202 }
198203 }
@@ -249,6 +254,13 @@ export class Manager extends Component {
249254 this . setState ( { autoplaying : false } ) ;
250255 clearInterval ( this . autoplayInterval ) ;
251256 }
257+ _toggleAutoplaying ( ) {
258+ if ( this . state . autoplaying ) {
259+ this . _stopAutoplay ( ) ;
260+ } else {
261+ this . _startAutoplay ( ) ;
262+ }
263+ }
252264 _handleEvent ( e ) {
253265 // eslint-disable-line complexity
254266 const event = window . event ? window . event : e ;
@@ -297,7 +309,7 @@ export class Manager extends Component {
297309 ! event . metaKey &&
298310 this . props . autoplay
299311 ) {
300- this . _startAutoplay ( ) ;
312+ this . _toggleAutoplaying ( ) ;
301313 } else if (
302314 event . altKey &&
303315 event . keyCode === 70 && // 'f'
0 commit comments