diff --git a/assets/js/tick.js b/assets/js/tick.js index 78a9564..66ea04c 100755 --- a/assets/js/tick.js +++ b/assets/js/tick.js @@ -142,10 +142,18 @@ Tick.prototype.set_timer = function() { var _this = this; + var _delay; if (this.running) { + if (this.options.delay.length == 1) { + _delay = this.options.delay[0]; + } else if (this.options.delay.length == 2) { + _delay = Math.floor( Math.random() * ( this.options.delay[1] - this.options.delay[0] + 1) + this.options.delay[0] ); + } else { + _delay = 1000; + } return this.timer = setTimeout(function() { return _this.tick(); - }, this.options.delay); + }, _delay ); } }; diff --git a/demo/assets/js/interface.js b/demo/assets/js/interface.js index bafa293..508710f 100755 --- a/demo/assets/js/interface.js +++ b/demo/assets/js/interface.js @@ -2,7 +2,7 @@ $( document ).ready( function() { $( '.tick' ).ticker( { - delay : 1000, + delay : [50, 1000], // will take random number in between 50 and 1000 ms separators : true }); -}); \ No newline at end of file +});