JavaScript Loading Progress Effect with jQuery

A very unique and amazing JavaScript code example to create JavaScript loading progress effects on the web pages. With this version, this JavaScript loading progress effect allows us to choose 4 layouts for displaying: bullets and timer, using bullets only, using GIF images and using custom images and text.

Within the JavaScript live demo, I also offer full detailed documentation and instructions to handle all functions, let go to live demo for enjoying now!

Try other JavaScript loading progress scripts on jsB@nk if you like:

- JavaScript Percentage Progress Bar script
- JavaScript Time-based Progress Bar
- JavaScript Percent Progress Bar
- JavaScript Timer Bar


Sampled by © JavaScriptBank.com
Using bullets & timer
Using bullets


Using images (gif)
Using image & text
a b c d


Documentation

List of Default Settings:
  • Use these key : value pairs as follows; Note that the last key : value pair does not have a trailing comma and values that use true or false (Boolean values) should not be in quotes.
    $(selector).progressIndicator( initialValue, { key: value, key: value, key: value })
    KeyValue
    (default shown)
    Description
    max100
    The circle is split into this max number of increments (default set to 100 to match a percentage going from 0-99).
    radius
    50Sets the radius of the circle in pixels measured from the centerX and centerY position (middle).
    centerX100Positions the center of the circle 100 pixels from the left edge of its container.
    centerY100
    Positions the center of the circle 100 pixels from the top edge of the container.
    clockwisetrueSets the direction of the rotation. Clockwise if true and counter (or anti for you British folk) clockwise if false.
    startPosition
    0.75This may not make sense if you don't know the coordinate system, but basically zero is the far right side of the circle or the x-y coordinates of ( x=radius, y=0 ) . So if you want to have the indicator start with the "zero" at the top of the circle, you need to start from 75% or 3/4 of your way around the circle. So basically, set 0 to start on the right, .25 (25%) for bottom, .5 (50%) for left and .75 (75%) would be the top of the circle where ( x = 0 , y = radius ).
    sizeStart
    80
    Sets the starting size of the element to 80 pixels. This sets the font size, the height & width of any element inside the span (like an image)
    sizeDec
    4
    Sets how much to decrement the size of the next element from the starting size. Try to avoid making the decrement size that would cause the last element to be too small or negative (for example: these settings would not look good, 10 spans inside the progress indicator (in the HTML), sizeStart = 20, sizeDec = 2; this would make the last span element have a size of zero (20 - 2 * 10 = 0).
    showValue
    trueAdds the progress indicator value to the "display" class inside the progress div. If you want to be tricky, add the display class to one of your spans to have the indicator move around with the other elements.
    timerActivefalse
    Initialize progression indicator start and stop functions allowing the indicator to move independent of the percent value.
    timerSpeed
    20Sets the setInterval time in milliseconds.
    timerIncrement1
    At each setInterval call, the progression indicator is incremented by this value. Make this number bigger to speed up the animation, but the bigger the number, the more choppy the animation.

Methods
  • Get & Set Progression Value
    // Get current value (percentage)
    var value = $(selector).data('progressIndicator').getValue();

    // Set/Update current value
    $(selector).data('progressIndicator').update( value );
  • Animation timer functions (the timerActive option must be true before these will work)
    // Start animation timer
    $(selector).data('progressIndicator').start();

    // Stop animation timer
    $(selector).data('progressIndicator').stop();

    // Reset animation timer (just resets position)
    $(selector).data('progressIndicator').reset();
Examples - Be sure to look at the demo source to see some other examples of what is possible!
  • These examples should be wrapped inside of a:

    $(document).ready(function(){ ... })

    replace the ellipsis (...) with the script in the column below.
Action Script Notes:
Set up timer, so the start & stop methods are available. And adjust animation speed.
$('.progress').progressIndicator(
0, {
timerActive : true,
showValue : false,
timerSpeed : 20,
timerIncrement : 1
});

The zero in the first line sets the initial position of the indicator, it's not really that important for the animation timer mode, but necessary to include.

"timerActive" enables the start and stop timer methods. "showValue" is set to false to hide the progression value. "timerSpeed" and "timerIncrement" were adjusted to make the progression animation fairly quick. In the demo they are set to 50 and 5 respectively so you can see how much faster you could make this animation without it being too choppy.
Rotate counter (anti) clockwise & other adjustments
$('.progress').progressIndicator({
clockwise : false,
startPosition : .32,
sizeStart : 5,
sizeDec : -1
});
Setting the clockwise option to false with reverse the indicator rotation. Note that reversing the direction also effects the "startPosition" so you may need to adjust this value as well. This example is from progression3 in the demo and it needs a startPostion of .32 (32%) to move the images to the top... the reason it isn't 25% is because the sizeStart begins small (5 pixels) and the sizeDec is negative so this actually increases the image size as it progresses through the elements. You'll probably end up tweeking these numbers to get the look you want.
Max value$('.progress').progressIndicator({
max : 200
});
By default, the progress indicator is set to work with percentages.. it really only goes from 0 to 99%, but by changing the max option, you can set a full rotation of the progress indicator to any value. Note, the value, set using the update method, and the max value can be fractions.

2000+ free JavaScripts
at www.JavaScriptBank.com