diff --git a/README.md b/README.md index 854cb32..c2595f4 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,7 @@ add the Following code to the <head> of your document. enableDrag:true, freeMove:true, swipeThreshold: 40, + freezeOnTabSwitch : false, responsive : [], diff --git a/src/js/lightslider.js b/src/js/lightslider.js index 6d9c79f..d61b1fc 100644 --- a/src/js/lightslider.js +++ b/src/js/lightslider.js @@ -36,6 +36,7 @@ freeMove: true, swipeThreshold: 40, responsive: [], + freezeOnTabSwitch : false, /* jshint ignore:start */ onBeforeStart: function ($el) {}, onSliderLoad: function ($el) {}, @@ -874,13 +875,15 @@ } } - $(window).on('focus', function(){ - $this.auto(); - }); - - $(window).on('blur', function(){ - clearInterval(interval); - }); + if(settings.freezeOnTabSwitch){ + $(window).on('focus', function(){ + $this.auto(); + }); + + $(window).on('blur', function(){ + clearInterval(interval); + }); + } $this.pager(); $this.pauseOnHover();