如何为jQuery UI进度栏设置值的动画? [英] How do you animate the value for a jQuery UI progressbar?

查看:79
本文介绍了如何为jQuery UI进度栏设置值的动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了jQuery UI进度条,但是不能使用jQuery animate来为其值设置动画.关于如何进行这项工作的任何想法?

I've setup a jQuery UI progressbar but can't use jQuery animate to animate it's value. Any ideas on how to make this work?

percentDone变量包含一个从0到100的数字,该数字表示滚动条应沿多远(正常工作).

The percentDone variable holds a number from 0 to 100 showing how far along the scrollbar should be (this works fine).

我尝试了几种不同的方法都无济于事.这是我到目前为止的内容:

I've tried several different things to no avail. Here's what I have so far:

var progressbar = $("#progressbar1").widget();

progressbar.animate({
    value: percentDone
}, 5000, function() {
    console.debug('done animating');
});

请注意,如果我使用值"方法更新滚动条,它可以正常工作,但会跳转到该值而不是平滑地为其设置动画:

Note that if I update the scrollbar using the "value" method it works fine but it jumps to that value instead of smoothly animating to it:

$("#progressbar1").progressbar('value', percentDone);

推荐答案

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆