开发者

jQuery: how to display progress for an indeterminate process?

开发者 https://www.devze.com 2022-12-14 14:47 出处:网络
The documentation on the jQuery progressBar says that this UI widget is not suitable for displaying progress of indeterminate length.

The documentation on the jQuery progressBar says that this UI widget is not suitable for displaying progress of indeterminate length.

It recommends one of two alternatives:

- an indeterminate pro开发者_JAVA百科gressBar, which is "coming soon".

- a spinner animation

I think a jQuery spinner is a textbox with up/down arrows to inc/dec the value. In other words, an input widget.

jQuery: how to display progress for an indeterminate process?

That can't be what the doc meant.

using jQuery, How do I display indeterminate progress?


By spinner, I think they mean an animated graphic which endlessly loops, or spins. Like this:

jQuery: how to display progress for an indeterminate process?


Try this:

<div id="pb"></div>
<script type="text/javascript">
$(document).ready(function () {
    $("#pb").progressbar({ value: 100 });
    IndeterminateProgressBar($("#pb"));
});
function IndeterminateProgressBar(pb) {
    $(pb).css({ "padding-left": "0%", "padding-right": "90%" });
    $(pb).progressbar("option", "value", 100);
    $(pb).animate({ paddingLeft: "90%", paddingRight: "0%" }, 1000, "linear",
        function () { IndeterminateProgressBar(pb); });
}
</script>


More like:

jQuery: how to display progress for an indeterminate process?


(source: vinofordinner.com)

or

jQuery: how to display progress for an indeterminate process?


I guess this is not a jQuery question... it's just a matter of animation.

You'll probably be fine by displaying an animated image just like the ones available from e.g. Ajax Load


I'm a little late to the party, but here's a plugin that leverages the jQuery UI Progressbar for an indeterminate progress bar:

http://demo.dochoffiday.com/jquery-loader/

Also, there are plans to include the indeterminate feature in the future:

http://blog.jqueryui.com/2010/12/progressbar-api-redesign/

0

精彩评论

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