Giter Club home page Giter Club logo

goalmeter's Introduction

GoalMeter

A simple progress bar / goal meter / "thermometer" display for displaying the progress towards a particular goal.

This jQuery plugin is pretty simple and requires you to have only some basic markup - styling is up to you. Do take a look at the base styles provided to get an idea of what elements you can/should apply styles to.

Starting out

Basic Markup required:

<div id="goal-meter-1" class="goal-meter">

	<div class="goal-meter-track">
		<div class="goal-meter-goal">
			<div class="goal-meter-amount"> 90000 </div>
		</div>
		<div class="goal-meter-progress">
			<div class="goal-meter-amount">47835 </div>
		</div>
	</div>

</div>

The Goal Meter can then be called with:

$("#goal-meter-1").goalMeter()

Available Options

	"goalAmount":     0     // Number:   Goal Amount 
	"progressAmount": 0,    // Number:   Progress Amount
	"animate":        true, // Boolean:  Animate? 
	"slideDuration":  1000, // Number:   Animation speed of the progress bar (milliseconds)
	"fadeDuration":   500,  // Number:   Animation fade in speed of the amount (ms)
	"formatter":      null  // Function: Optional formatter function.  

Examples

Simple goal meter with numbers already in the DOM

$(".goal-meter").goalMeter();

Provide your own values

$("#goal-meter").goalMeter({
	"goalAmount": 1000,
	"progressAmount": 425
});

Using a formatter

$(".goal-meter").goalMeter({
	formatter: function(number) {
		return "$" + number; //just prepend the number with a currency symbol
	}
})

Live updating

// Somewhere at the start of your code - you init the goal meter

$("#goal-meter").goalMeter(); // let's say your DOM had a goal of 1000 and a progress of 425

// Sometime later...
// You might get some data from the server via an asynchronous request.
// If you want to update the goal meter simply call it on that same element...
// Just with updated values.

$("#goal-meter").goalMeter({ progressAmount: 535 });

Origins

The initial goal of this script was to provide a "Fund raising thermometer".

goalmeter's People

Contributors

jvdl avatar mikehermary avatar

Watchers

 avatar

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.