From 90bc3414b10fab4bb274e230ffecc1a9e3c11d81 Mon Sep 17 00:00:00 2001 From: Ash Glover Date: Thu, 25 Feb 2016 12:20:30 +0200 Subject: [PATCH] edits based on solution by russelcole at https://github.com/bfintal/Counter-Up/issues/28#issue-132097963 --- jquery.counterup.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jquery.counterup.js b/jquery.counterup.js index bc7871f..3d6223b 100644 --- a/jquery.counterup.js +++ b/jquery.counterup.js @@ -22,11 +22,18 @@ // Store the object var $this = $(this); var $settings = settings; + var $originalText = $this.text(); + // added this line based on solution by russelcole + // https://github.com/bfintal/Counter-Up/issues/28#issue-132097963 var counterUpper = function() { var nums = []; var divisions = $settings.time / $settings.delay; var num = $this.text(); + var num = $originalText; + // added this line based on solution by russelcole + // https://github.com/bfintal/Counter-Up/issues/28#issue-132097963 + var isComma = /[0-9]+,[0-9]+/.test(num); num = num.replace(/,/g, ''); var isInt = /^[0-9]+$/.test(num); @@ -80,4 +87,4 @@ }; -})( jQuery ); \ No newline at end of file +})( jQuery );