javascript - Stop and Reset Harvest's Tick Counter jQuery Plugin -


anyone knows how stop , reset harvest's tick counter jquery plugin? want stop counter on specific number , reset primary start number.

you can checkout code here.

html markup:

<span class="tick tick-flip tick-promo">5,000</span> 

jquery logic:

<script type="text/javascript"> $(document).ready(function () {     startcounter(); });  function startcounter() {     $('.tick').ticker({         delay: 1000,         incremental: 1,         separators: true     }); }  var mycounter = setinterval(function resetcounter() {     var lscurrenttick = $('.tick').find('.tick-new').text();      if (lscurrenttick > 5010) {         $.fn.ticker.stop();     } }, 1000);  </script> 

i had read code figure out. here demo

$(startcounter);  function startcounter() {     var tickobj = $('.tick').ticker({         delay: 1000,         incremental: 1,         separators: true     })[0];     setinterval(function () {         if (tickobj.value >= 5002) {             tickobj.stop();             tickobj.value = 5000;             tickobj.start();         }     }, 1000); } 

if feeling brave can mess tick.prototype.tick demo

function startcounter() {     var tickobj = $('.tick').ticker({         delay: 1000,         incremental: 1,         separators: true     })[0];     tickobj.tick = (function (tick) {         return function () {             var ret = tick.call(tickobj);             if (tickobj.value > 5002) {                 tickobj.stop();                 tickobj.value = 5000;                 tickobj.start();             }             return ret;         };     }(tickobj.tick)); } 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -