GithubHelp home page GithubHelp logo

kiteoath / percentageloader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lepoetemaudit/percentageloader

0.0 2.0 0.0 161 KB

jQuery plugin for displaying an animated percentage loader

License: Other

HTML 16.40% CSS 1.43% JavaScript 82.17%

percentageloader's Introduction

PercentageLoader

Introduction

PercentageLoader is a plugin with optional jQuery support for displaying a progress widget in more visually striking way than the ubiquitous horizontal progress bar / textual counter. The plugin takes miniminal installation and is simple and flexibile to use. It makes use of HTML 5 canvas for a rich graphical appearance with only a 10kb (minified) javascript file necessary (suggested web font optional). It uses vectors rather than images so can be easily deployed at various sizes by simply adjusting the initial parameters. For a live demo please see http://widgets.better2web.com/loader

Requirements

  • jQuery 1.4+ (if using the jQuery interface)
  • Firefox 3.0+, Safari 4.0+, Chrome 7+, IE9+, Opera 9+

(i.e any browser with reasonable canvas support)

Licence

This jQuery plugin is licensed under the Simplified BSD License. Please see the file license.txt for full information on the licence.

Installation

  1. Include the javascript file (a minified version is also provided)
  2. You can also include the (optional but recommended web font) - Bebas Neue + fontkit CSS. This can found downloaded at http://www.fontsquirrel.com/fonts/bebas-neue
  3. Run $.percentageLoader on any block element where you want the widget to appear if using jQuery, or simply var loader = new PercentageLoader(domElement, options)

Options include:

  • progress (initial starting position of loader, range 0 - 1.0)
  • value (initial label for the value)
  • width (default 256)
  • height (default 256)
  • controllable (true/false, defaults to false) allows the user to set the value by clicking
  • onProgressUpdate(value) - provide a callback function for controllable loaders with the updated value

Examples:

// jQuery
$("#myDiv").percentageLoader({
    width : 180, height : 180, progress : 0.5, value : '512kb'});
    
// Without jQuery
var loader = new PercentageLoader(
    document.getElementById('myDiv'), 
    {width : 180, height : 180, progress : 0.5, value : '512kb'});

You can update the values by using the same call if using jQuery, e.g.

$("#myDiv").percentageLoader({value: '250kb', progress: 0.5);

Otherwise, use the methods returned when you created the loader:

loader.setValue('250kb');
loader.setProgress(0.5);

You can handle updates with a user-controllable loader with a callback function:

var loader;
loader = $("myDiv").percentageLoader({
    controllable : true,
    onProgressUpdate : function (value) {
        this.setProgress(value * 100.0);
    }
});

Note how this in the callback is scoped to the underlying plugin object, where you can call setProgress and setValue directly.

percentageloader's People

Contributors

lepoetemaudit avatar

Watchers

James Cloos avatar  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.