Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Data counter?

Options
  • 17-07-2015 12:26pm
    #1
    Registered Users Posts: 1,298 ✭✭✭


    Hi Everyone,

    A client is looking for one of these elements on their new website. Not sure what they're called is it data counters? Have a fairly good idea on how to write it out from scratch but if I can find a pre existing plugin i'd rather go down that route.

    355567.png


Comments

  • Registered Users Posts: 262 ✭✭Banta


    Found the github of one online, and then saw a CodePen of the same plugin here: http://codepen.io/chumpyy/pen/opgxC

    I reckon that should do what you're looking for. Looks good, with plenty of configurable options.


  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    Perfect thanking you!


  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    http://stackoverflow.com/questions/2540277/jquery-counter-to-count-up-to-a-target-number also found this incase anyone else is stuck. Tis fairly handy to use!


  • Registered Users Posts: 262 ✭✭Banta


    The most upped answer is the same guy that I linked to ha ha!!! Only when reading the code did I think "Hmm, this looks familiar" then saw the posters name.

    You know I'm just going to have a find a use for this now. Seems like a pretty nifty bit of script.


  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    Banta wrote: »
    The most upped answer is the same guy that I linked to ha ha!!! Only when reading the code did I think "Hmm, this looks familiar" then saw the posters name.

    You know I'm just going to have a find a use for this now. Seems like a pretty nifty bit of script.

    That one is fairly handy also found this and it makes it alot easier, you don't need data-from to or speed in your html element. Just put the value into the HTML and this script animates up to it. [HTML]var counter = $('#counter').offset().top;

    $(window).scroll(startCount);
    function startCount() {
    if ($(window).scrollTop() > counter) {
    $(window).off("scroll", startCount);
    $('.timer').each(function () {
    var $this = $(this);
    jQuery({ Counter: 0 }).animate({ Counter: $this.text() }, {
    duration: 2000,
    easing: 'swing',
    step: function () {
    $this.text(Math.ceil(this.Counter));
    }
    });
    });
    }
    }[/HTML]


  • Advertisement
Advertisement