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 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 +})();