Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Delay does not behave as Expected #6

Open
ChristianTheMinery opened this issue Feb 23, 2017 · 1 comment
Open

Delay does not behave as Expected #6

ChristianTheMinery opened this issue Feb 23, 2017 · 1 comment

Comments

@ChristianTheMinery
Copy link

ChristianTheMinery commented Feb 23, 2017

EDIT: I've just taken a closer look at the readme and this is apparently the intended behaviour. It seems a bit odd to call it delay; something more descriptive like step_delay might be better. I'd also take this opportunity to then suggest that this plugin support an actual delay setting, to delay an animation for a time before playing.


The data-counterup-delay property on an element is not behaving as expected. Assume the following:

On the HTML page:

<span class="counter" data-counterup-delay="1500">12</span>

And in the JavaScript:

$('.counter').counterUp({
    time: 3000
});

This does not cause the animation to delay for 1500, and then animate for 3000. The animation plays immediately but seems to simply not animate any steps for the delay period.

To explain what I mean, look at the numbers above. 1500 is half of 3000; the delay is half the duration. What I'm actually seeing on the page is that the counter will remain at zero, then jump to 6, then remain at 6, then jump to 12.

EDIT: And upon further testing, this behaviour is consistent with other times. For example, setting the delay to 500 causes the counter to jump to 2, then 4, then 6, etc.

I've also tried moving the delay to the JavaScript function:

$('.counter').counterUp({
    delay: 1500,
    time: 3000
});

And the same behaviour is exhibited.

In addition, if the delay is set longer than the duration, the counter will simply not animate at all.

@ciromattia
Copy link
Owner

For the moment I added the offset parameter which makes you able to make it start at a given percentile of the viewport, instead of on enter (100%)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants