Skip to content

Commit

Permalink
Bug Fix: Autoplay was not properly resumed on blur(#117).
Browse files Browse the repository at this point in the history
  • Loading branch information
NaotoshiFujita committed Aug 23, 2020
1 parent cef2c77 commit b6b0617
Show file tree
Hide file tree
Showing 7 changed files with 244 additions and 212 deletions.
21 changes: 14 additions & 7 deletions dist/js/splide.esm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Splide.js
* Version : 2.4.11
* Version : 2.4.12
* License : MIT
* Copyright: 2020 Naotoshi Fujita
*/
Expand Down Expand Up @@ -4392,17 +4392,24 @@ var PAUSE_FLAGS = {
switchOn(elms, 'focusin', PAUSE_FLAGS.FOCUS, false);
}

Splide.on('click', function () {
// Need to be removed a focus flag at first.
Autoplay.play(PAUSE_FLAGS.FOCUS);
Autoplay.play(PAUSE_FLAGS.MANUAL);
}, Elements.play).on('move refresh', function () {
if (Elements.play) {
Splide.on('click', function () {
// Need to be removed a focus flag at first.
Autoplay.play(PAUSE_FLAGS.FOCUS);
Autoplay.play(PAUSE_FLAGS.MANUAL);
}, Elements.play);
}

if (Elements.pause) {
switchOn([Elements.pause], 'click', PAUSE_FLAGS.MANUAL, false);
}

Splide.on('move refresh', function () {
Autoplay.play();
}) // Rewind the timer.
.on('destroy', function () {
Autoplay.pause();
});
switchOn([Elements.pause], 'click', PAUSE_FLAGS.MANUAL, false);
}
/**
* Play or pause on the given event.
Expand Down
21 changes: 14 additions & 7 deletions dist/js/splide.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Splide.js
* Version : 2.4.11
* Version : 2.4.12
* License : MIT
* Copyright: 2020 Naotoshi Fujita
*/
Expand Down Expand Up @@ -4382,17 +4382,24 @@ var PAUSE_FLAGS = {
switchOn(elms, 'focusin', PAUSE_FLAGS.FOCUS, false);
}

Splide.on('click', function () {
// Need to be removed a focus flag at first.
Autoplay.play(PAUSE_FLAGS.FOCUS);
Autoplay.play(PAUSE_FLAGS.MANUAL);
}, Elements.play).on('move refresh', function () {
if (Elements.play) {
Splide.on('click', function () {
// Need to be removed a focus flag at first.
Autoplay.play(PAUSE_FLAGS.FOCUS);
Autoplay.play(PAUSE_FLAGS.MANUAL);
}, Elements.play);
}

if (Elements.pause) {
switchOn([Elements.pause], 'click', PAUSE_FLAGS.MANUAL, false);
}

Splide.on('move refresh', function () {
Autoplay.play();
}) // Rewind the timer.
.on('destroy', function () {
Autoplay.pause();
});
switchOn([Elements.pause], 'click', PAUSE_FLAGS.MANUAL, false);
}
/**
* Play or pause on the given event.
Expand Down
4 changes: 2 additions & 2 deletions dist/js/splide.min.js

Large diffs are not rendered by default.

Binary file modified dist/js/splide.min.js.gz
Binary file not shown.
Loading

0 comments on commit b6b0617

Please sign in to comment.