How to create Cash Register Effect using Pure Javascript? -


i wanted create cash register effect using pure javascript(with out using libraries),

here link cash register effect implemented using mootools,

http://jsbin.com/ehuzes/edit#preview

i want effect using raw javascript. huge help, if gives solution.

$('#number').on('change', function (e) {     $(this).cashregister($(this).val()); });  (function ($) {     $.fn.cashregister = function (num) {         var output = $('#output').html();          function intervalfunc(interval, num) {             var end = parseint($('#number').html());             var cont =  parseint($('#output').html())              $('#output').html( cont + interval );             if ( $('#output').html() == num ) {                 clearinterval(int);                 return false;             }         }         if (num > output) {            var int = setinterval(function() { intervalfunc(1, num) }, 0.1);            }else if (num < output) {            var int = setinterval(function() { intervalfunc(-1, num) }, 0.1);                }else if (num == $('#output').html() ) {            // nothing        }else{           alert("invalid input!");        }     }; })(jquery); 

http://jsfiddle.net/duljc/3/ -> working version of suggested fix


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -