Hi,
thank you for share your issue. I think the last update screwed that, and I hadn’t noticed. Let me fix it, and I reply you when it’s done.
See you. 🙂
Hi again, I’ve already fix your issue, please update to version 2.2.
I add a new option inside of the shortcode, named: “scroll”. For your issue, you should do this:
[countup start=”0″ end=”44″ scroll=”false”]
If the option scroll is “false”, the counter starts when the page is loaded, if it’s true, the counter starts when you scroll it to the counter.The default value is “true”.
Please, update it, and tell me if it worked to you. See you.
Hello Roel,
It works fine. Thanks a lot.
Your welcome, thank you for make this plugin better.
Hi, Roel
Your fix still does not take into account one thing: On some displays the counter might be visible from the start, whereas on others it might require scrolling the counter into viewport. Maybe you should consider the following code:
function wpcjs_check_visibility() {
var currentPosition = $( document ).scrollTop();
for ( var i in counterObjects ) {
if ( currentPosition > counterObjects[i].objectPositionTop && eventFired === false ) {
counterObjects[i].numAnimObject.start();
}
}
}
window.onload = function() {
wpcjs_get_counter();
wpcjs_check_visibility();
$( window ).on( 'scroll', wpcjs_check_visibility);
};
This way, the loop checking positions of object is fired no only on Scroll, but also on Load event.
Thanks for the feedback, if you could tell me how to replicate the issue so I can run some tests with your code. 🙂
Hi kmbt! I tested your code, but didn’t worked for me, also, I found another code at StackOverflow which the counter starts if it’s visible in the viewport.
Could you test it, please?
Thanks! Let me know what happened! 🙂