Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li><a href="http://so.lucafilosofi.com/how-do-you-animate-the-value-for-a-jquery-ui-progressbar/?progressbar=1" rel="nofollow noreferrer"><strong>DEMO 1:</strong></a> the first one, proof of concept</li> </ul> <pre><code>$(function() { var pGress = setInterval(function() { var pVal = $('#progressbar').progressbar('option', 'value'); var pCnt = !isNaN(pVal) ? (pVal + 1) : 1; if (pCnt &gt; 100) { clearInterval(pGress); } else { $('#progressbar').progressbar({value: pCnt}); } },10); }); </code></pre> <ul> <li><a href="http://so.lucafilosofi.com/how-do-you-animate-the-value-for-a-jquery-ui-progressbar/?progressbar=2" rel="nofollow noreferrer"><strong>DEMO 2:</strong></a>: adaptation of @Peter's response below for the good sake ;-). </li> </ul> <pre><code>$(function() { $('#progressbar').progressbar(); // inizializa progressbar widget $pVal = $('.ui-progressbar-value').addClass('ui-corner-right'); var pGress = setInterval(function() { //generate our endless loop var pCnt = $pVal.width(); // get width as int // generate a random number between our max 100 and it's half 50, // this is optional, and make the bar move back and forth before // we reach the end. var rDom = Math.floor(Math.random() * (100 - 50 + 1) + 50); var step = rDom &gt;= 100 ? 100: rDom; // reached our max ? reset step. doAnim(step); },1000); var doAnim = function(wD) { // complete easing list http://jqueryui.com/demos/effect/easing.html $pVal.stop(true).animate({width: wD + '%'},1000, 'easeOutBounce'); if (wD &gt;= 100) clearInterval(pGress) /* run callbacks here */ } }); </code></pre> <p>In a real application you may not need to generate a loop, for example, while uploading a file, your flash aplication will tell you the filesize and let you know when you have reached the max value needed, so my first code is intended to demonstrate just the use of the progressbar setter and getter and of course what make the whole thing play, that is for instance, the loop; the second one is an adaptation of the same concept with sugar.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload