bfintal / Counter-Up

Counter-Up is a lightweight jQuery plugin that counts up to a targeted number when the number becomes visible.
http://bfintal.github.io/Counter-Up/demo/demo.html
GNU General Public License v2.0
746 stars 722 forks source link

Scrolling away from counter then back again gives incorrect final value #28

Open russelcole opened 8 years ago

russelcole commented 8 years ago

I came across a problem with scrolling away from the counter whilst it was still in progress and then scrolling back again

If the original value is 100 and I scrolled away at 50, when I scrolled back it would count from 0 to 50 not 100

I fixed this by: var $settings = settings; var $originalText = $this.text(); // added this line

Changed: var num = $this.text(); to var num = $originalText;

artreaktor-niks commented 8 years ago

In Chrome I had numbers 0 ... 0 ... 0

Your fix helped. Thanks !

rginnow commented 8 years ago

Fixed for me too! You should make a pull request or fork. This project doesn't seem to kept up with.

onepartscissors commented 8 years ago

Hi All, i needed this more reliable for a project, so i forked it and added a 'total' variable that it always relies on. If the total is missing, it will work as per the original, using the text supplied by "$this.text()".

Here it is:

https://github.com/onepartscissors/Counter-Up

ciromattia commented 8 years ago

In my fork I merged a bunch of PRs - it's already on bower and NPM.

This issue should be fixed with Waypoints-4.0.0 support (thanks to @digsite PR), please check it out and tell me if it works. Thanks!

dnunes commented 6 years ago

You can look up a simple solution on the CounterUp side (rather than changing WayPoint integration) on my reply at https://github.com/bfintal/Counter-Up/issues/57#issuecomment-369732234. It is a needed fix anyway, even if you use the correct new WayPoint methods.

k4dm3l commented 5 years ago

Thanks, this fork works for me :D