├── LICENSE.txt ├── README.md ├── jQMeter.jquery.json ├── jqmeter.js └── jqmeter.min.js /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright Gerardo Larios http://www.gerardolarios.com 2 | This software consists of voluntary contributions made by the developer. For exact contribution history, see the revision history 3 | available at https://github.com/glarios/jQMeter 4 | The following license applies to all parts of jQMeter except as 5 | documented below: 6 | ==== 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | ==== 24 | Copyright and related rights for sample code are waived via CC0. Sample 25 | code is defined as all source code displayed within the README. 26 | CC0: http://creativecommons.org/publicdomain/zero/1.0/ 27 | ==== 28 | All files located in the node_modules and external directories are 29 | externally maintained libraries used by this software which have their 30 | own licenses; we recommend you read them, as their terms may differ from 31 | the terms above. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
jQMeter is a simple, light-weight jQuery plugin that allows you to display an animated horizontal or vertical progress meter. Just pass in the goal and amount raised or completed, and the rest is optional.
3 |It has a simple design out-of-the-box, but this is on purpose so that you can customize the look to match your needs. You can pass several formatting options including width, height, background bar color, bar color, etc. You can also choose to display the percentage completed or not, as well as control the animation speed.
4 |All you need to do is include the plugin file into your webpage, create a target wrapper element, and pass that element's id into the jQMeter
method.
Include the above files into your webpage and invoke the jQMeter()
method.
You can add your own CSS to style the progress meter to fit your needs.
15 | 16 |Create an empty wrapper element, in this case a <div>
, and assign a unique id or class to it. Then pass that id into the jQMeter()
method.
19 | <div id="jqmeter-container"></div>
20 | <script type="text/javascript">
21 | $(document).ready(function(){
22 | $('#jqmeter-container').jQMeter();
23 | });
24 | </script>
25 |
26 |
27 | jQMeter is pretty much ready to go, and the only necessary parameters to get started are the goal
and raised
values. It also has several options for customization. Some of these customizations can also be achieved with CSS such as colors, etc. Pass these options as an object into the jQMeter()
method like this:
$('#jqmeter-container').jQMeter({
30 | goal:'$1,000',
31 | raised:'$200',
32 | meterOrientation:'vertical',
33 | width:'50px',
34 | height:'200px'
35 | });
36 |
37 |
38 | jQMeter is free to use under the MIT/GPL license for any application. 55 |
56 |This plugin was written by Gerardo Larios.
58 | -------------------------------------------------------------------------------- /jQMeter.jquery.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jQMeter", 3 | "title": "jQMeter - Thermometer Plugin", 4 | "description": "jQuery plugin that allows you to display an animated horizontal or vertical progress meter.", 5 | "keywords": [ 6 | "progress", 7 | "animation", 8 | "thermometer", 9 | "progress-meter", 10 | "progress-thermometer", 11 | "meter" 12 | ], 13 | "version": "0.1.2", 14 | "author": { 15 | "name": "Gerardo Larios", 16 | "url": "http://gerardolarios.com/plugins-and-tools/jqmeter/" 17 | }, 18 | "maintainers": [ 19 | { 20 | "name": "Gerardo Larios", 21 | "email": "gerardo@gerardolarios.com", 22 | "url": "http://gerardolarios.com" 23 | } 24 | ], 25 | "licenses": [ 26 | { 27 | "type": "MIT", 28 | "url": "https://github.com/glarios/jQMeter/blob/master/LICENSE.txt" 29 | } 30 | ], 31 | "bugs": "https://github.com/glarios/jQMeter/issues", 32 | "homepage": "http://gerardolarios.com/plugins-and-tools/jqmeter/", 33 | "docs": "http://gerardolarios.com/plugins-and-tools/jqmeter/", 34 | "download": "http://gerardolarios.com/plugins-and-tools/jqmeter/", 35 | "dependencies": { 36 | "jquery": ">=1.5" 37 | } 38 | } -------------------------------------------------------------------------------- /jqmeter.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Title: jQMeter: a jQuery Progress Meter Plugin 4 | Author: Gerardo Larios 5 | Version: 0.1.2 6 | Website: http://www.gerardolarios.com/plugins-and-tools/jqmeter 7 | License: Dual licensed under the MIT and GPL licenses. 8 | 9 | */ 10 | 11 | (function($) { 12 | 13 | //Extend the jQuery prototype 14 | $.fn.extend({ 15 | jQMeter: function(options) { 16 | if (options && typeof(options) == 'object') { 17 | options = $.extend( {}, $.jQMeter.defaults, options ); 18 | } 19 | this.each(function() { 20 | new $.jQMeter(this, options); 21 | }); 22 | return; 23 | } 24 | }); 25 | 26 | $.jQMeter = function(elem, options) { 27 | //Define plugin options 28 | goal = parseInt((options.goal).replace(/\D/g,'')); 29 | raised = parseInt((options.raised).replace(/\D/g,'')); 30 | width = options.width; 31 | height = options.height; 32 | bgColor = options.bgColor; 33 | barColor = options.barColor; 34 | meterOrientation = options.meterOrientation; 35 | animationSpeed = options.animationSpeed; 36 | counterSpeed = options.counterSpeed; 37 | displayTotal = options.displayTotal; 38 | total = (raised / goal) * 100; 39 | 40 | /* 41 | * Since the thermometer width/height is set based off of 42 | * the total, we force the total to 100% if the goal has 43 | * been exceeded. 44 | */ 45 | if(total >= 100) { 46 | total = 100; 47 | } 48 | 49 | //Create the thermometer layout based on orientation option 50 | if(meterOrientation == 'vertical') { 51 | 52 | $(elem).html('