diff --git a/src/components/slideshow/slideshow.js b/src/components/slideshow/slideshow.js index f725745ddc..40d87e9519 100644 --- a/src/components/slideshow/slideshow.js +++ b/src/components/slideshow/slideshow.js @@ -198,6 +198,20 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f } } + function onAutoplayStart() { + var btnSlideshowPause = dlg.querySelector('.btnSlideshowPause i'); + if (btnSlideshowPause) { + btnSlideshowPause.innerHTML = "pause"; + } + } + + function onAutoplayStop() { + var btnSlideshowPause = dlg.querySelector('.btnSlideshowPause i'); + if (btnSlideshowPause) { + btnSlideshowPause.innerHTML = ""; + } + } + function loadSwiper(dlg) { if (currentOptions.slides) { @@ -225,6 +239,9 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f speed: 240 }); + swiperInstance.on('autoplayStart', onAutoplayStart); + swiperInstance.on('autoplayStop', onAutoplayStop); + if (layoutManager.mobile) { pause(); } else { @@ -336,23 +353,15 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f } function play() { - - var btnSlideshowPause = dlg.querySelector('.btnSlideshowPause i'); - if (btnSlideshowPause) { - btnSlideshowPause.innerHTML = "pause"; + if (swiperInstance.autoplay) { + swiperInstance.autoplay.start(); } - - swiperInstance.startAutoplay(); } function pause() { - - var btnSlideshowPause = dlg.querySelector('.btnSlideshowPause i'); - if (btnSlideshowPause) { - btnSlideshowPause.innerHTML = ""; + if (swiperInstance.autoplay) { + swiperInstance.autoplay.stop(); } - - swiperInstance.stopAutoplay(); } function playPause() {