在jQuery UI中使用Progressbar Widget的问题 [英] Problem with Progressbar Widget in jQuery UI

查看:71
本文介绍了在jQuery UI中使用Progressbar Widget的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次调用函数LoadProgressBar(),它将显示加载过程...但是当我再次单击该按钮时,它不会显示。请帮忙,我是新来的......







< button onclick =LoadProgressBar()> BUTTON< / button>





$(函数(){

函数LoadProgressBar(){



var progressbar = $( #progressbar),

progressLabel = $(。progress-label);



progressbar.progressbar({

值:false,

更改:function(){

progressLabel.text(progressbar.progressbar(value)+%);

},

完成:function(){

progressLabel.text(Complete!);

}

});



函数进度(){



var progress_value = progressbar.progressbar(value);

progress_value = Math.floor((数学。 random()* 20)+ 1);



var val = progressbar.progressbar(value)|| 0;

progressbar.progressbar(value,val + progress_value);



if(val< 99){

setTimeout(进度,500);

}

}

setTimeout(进度,2000);

}

});

解决方案

(function(){

函数LoadProgressBar(){



var progressbar =


(#progressbar),

progressLabel =

(。progress-label);



progressbar.progressbar({

value:false,

更改:function(){

progressLabel.text(progressbar.progressbar(value)+%);

},

完成:function(){

progressLabel.text(完成!);

}

});



函数进度(){



var progress_value = progressbar.progressbar( value);

progress_value = Math.floor((Math.random()* 20)+ 1);



var val = progressbar.progressbar(value)|| 0;

progressbar.progressbar(value,val + progress_value);



if(val< 99){

setTimeout(进度,500);

}

}

setTimeout(进度,2000);

}

});


For the first time that I will call the function LoadProgressBar(), it will show the loading procedure... But when I click the button again, it doesn't show up. Please help, I am new here...



<button onclick="LoadProgressBar()">BUTTON</button>


$(function(){
function LoadProgressBar() {

var progressbar = $("#progressbar"),
progressLabel = $(".progress-label");

progressbar.progressbar({
value: false,
change: function () {
progressLabel.text(progressbar.progressbar("value") + "%");
},
complete: function () {
progressLabel.text("Complete!");
}
});

function progress() {

var progress_value = progressbar.progressbar("value");
progress_value = Math.floor((Math.random() * 20) + 1);

var val = progressbar.progressbar("value") || 0;
progressbar.progressbar("value", val + progress_value);

if (val < 99) {
setTimeout(progress, 500);
}
}
setTimeout(progress, 2000);
}
});

解决方案

(function(){
function LoadProgressBar() {

var progressbar =


("#progressbar"),
progressLabel =


(".progress-label");

progressbar.progressbar({
value: false,
change: function () {
progressLabel.text(progressbar.progressbar("value") + "%");
},
complete: function () {
progressLabel.text("Complete!");
}
});

function progress() {

var progress_value = progressbar.progressbar("value");
progress_value = Math.floor((Math.random() * 20) + 1);

var val = progressbar.progressbar("value") || 0;
progressbar.progressbar("value", val + progress_value);

if (val < 99) {
setTimeout(progress, 500);
}
}
setTimeout(progress, 2000);
}
});


这篇关于在jQuery UI中使用Progressbar Widget的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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