From edf00ec07747fc47659da2e336cc63014f6a1eaa Mon Sep 17 00:00:00 2001 From: gfabrizi Date: Wed, 18 Jan 2017 21:32:13 +0100 Subject: [PATCH 1/2] Added option to avoid slider stopping on blur Added the option stopOnBlur (default to true) to prevent the stop of the slider if the browser window lost focus. --- ideal-image-slider.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ideal-image-slider.js b/ideal-image-slider.js index f8889b4..bd2e968 100644 --- a/ideal-image-slider.js +++ b/ideal-image-slider.js @@ -410,6 +410,7 @@ var IdealImageSlider = (function() { keyboardNav: true, previousNavSelector: '', nextNavSelector: '', + stopOnBlur: true, classes: { container: 'ideal-image-slider', slide: 'iis-slide', @@ -647,9 +648,11 @@ var IdealImageSlider = (function() { this.settings.onStart.apply(this); // Stop if window blur - window.onblur = function() { - this.stop(); - }.bind(this); + if (this.settings.stopOnBlur) { + window.onblur = function() { + this.stop(); + }.bind(this); + } }; Slider.prototype.stop = function() { @@ -829,4 +832,4 @@ var IdealImageSlider = (function() { Slider: Slider }; -})(); \ No newline at end of file +})(); From 9b0e408a831319cc6df7b79228619baaef150ac1 Mon Sep 17 00:00:00 2001 From: gfabrizi Date: Thu, 19 Jan 2017 11:44:20 +0100 Subject: [PATCH 2/2] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3b3ca63..82f4f06 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ in your CSS. |keyboardNav|`true`|Toggle keyboard navigation| |previousNavSelector|`''`|Selector for custom previous nav element| |nextNavSelector|`''`|Selector for custom next nav element| +|stopOnBlur|`true`|Prevent the slider to stop when browser lost its focus| |classes|`{...}`|List of classes to be used by slider. Probably shouldn't be changed| ## Events