Coder Social home page Coder Social logo

theleoad / counterup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joshuapbritz/counterup

0.0 1.0 0.0 6 KB

Pure javascript, light weight counter to display couting up or down to a numeric value. Usefull for tht trendy website you are building

HTML 16.17% JavaScript 83.83%

counterup's Introduction

counterUp

CounterUp is a pure javascript, light weight (1600 bytes) counter to display counting up or down to a numeric value in a given frame of time. Useful to show how many happy customers you have on that trendy website you are building.

With counterUp you can easily build simple up/down counters, elapsing time, countdowns and much more.

Installation

Just get the count-up.js file here and include it in your HTML. Done.

Usage

counterUp just need one or more HTML elements to hold the displayed value. You can bind the countUp to as many elements as you want using standard CSS selectors.

Params:

  • selector = the selector used to bind the counterUp to DOM elements
  • duration = the total duration in ms until the target value is reached
  • prepend = a string to prepend to the numeric value (for example a $ sign)
  • append = a string to append to the numeric value (for example a % sign)
  • start = the starting value of the count
  • end = the ending value of the count
  • intvalues = set true if we want to show floating point values (it uses 2 decimals)
  • interval = the refresh interval of the counter in ms

Create one or more instances of counterUp like so:

var mycounter = new counterUp({
        selector: '.myselector',
        duration: 2000
    });

When you're ready to go, just call the start method and see the numbers go. Jeeez!

mycounter.start();

You can both set global parameters while creating the counterUp instance, or set a different parameter for every DOM element specifying the parameter you want to set using cup-parametername attributes.

<span class=".myselector" cup-duration="3000" cup-end="100" cup-append="% completed"></span>
<span class=".myselector" cup-duration="6000" cup-end="2500" cup-prepend="$"></span>

Have fun counting!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.