Skip to content

Conversation

alihalabyah
Copy link

No description provided.

// Do first animation
if (counter.auto === true) nextCount = setTimeout(_doCount, counter.pace);
// Stop counter
if (counter.value === counter.stop) _clearNext();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=== forces you to have an exact value to stop the counter.
I suggest if (counter.value >= counter.stop) _clearNext(); to stop the counter.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid point

@vivianreact
Copy link

`function _doCount(first) {
var first_run = typeof first === "undefined" ? false : first;

x = counter.value.toFixed(counter.decimals);

if (!first_run) counter.value += counter.inc;
y = counter.value.toFixed(counter.decimals);

if (y >= counter.stopValue) 
{
	y = counter.stopValue;
	_digitCheck(x, y);
	this.stop();
	counter.auto = false;
	_clearNext();
}
else
{
	_digitCheck(x, y);
}

// Do first animation
if (counter.auto === true) nextCount = setTimeout(_doCount, counter.pace);

}`

Should add y = counter.stopValue to ensure the stop value is what you want instead of bigger or smaller value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants