• Resolved aureliendebord

    (@aureliendebord)


    Hello,
    The counter is displayed on the center of my homepage, it is visible from the beginning of the page.
    But the counter starts only if I scrolled a bit.
    How can the counter start as soon as page is loaded ?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Roel Magdaleno

    (@rokumetal)

    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. 🙂

    Plugin Author Roel Magdaleno

    (@rokumetal)

    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.

    Thread Starter aureliendebord

    (@aureliendebord)

    Hello Roel,

    It works fine. Thanks a lot.

    Plugin Author Roel Magdaleno

    (@rokumetal)

    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.

    Plugin Author Roel Magdaleno

    (@rokumetal)

    Thanks for the feedback, if you could tell me how to replicate the issue so I can run some tests with your code. 🙂

    Plugin Author Roel Magdaleno

    (@rokumetal)

    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! 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Counter doesn’t start’ is closed to new replies.