开发者

how can i reuse progressbar that is created by jquery in a div

I want to use the same progressbar multiple ti开发者_高级运维mes that is crated by jquery in a div. So how can i reinitiate the progressbar.


What's stopping you from just doing $('#yourelement').progressbar('value', 0); to reset the progress bar back to 0%?

Unless you're not using jQuery UI, in which cause you'd just have to do $('#yourelement').width('0%') or something similar.


$('#yourprogressbarid').progressbar('option', 'value', 0);

Assuming you are using jQuery UI progressbar.


perhaps this would help:

I had a problem when re-using a JQuery ProgressBar, because when you reset the progress bar to 0, it takes some time for the bar to move back to 0 (since ProgressBar smoothly moves from one value to the next).

My answer was to reset the progressBar to 0, when it is hidden.

So the algorithm is:

  1. process starting (e.g. file upload)
  2. show progress bar
  3. update progress as the process completes

    $('#jqProgressID').progressBar(percent);

  4. when process completes, hide the progress bar

  5. NOW reset the progress bar to 0:

    $('#jqProgressID').progressBar(0);

This allows you to re-use the progress bar, without the user having to view the bar resetting to 0.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜