我正在尝试为下载操作设置进度条。这是我的代码。即使我能够获取值,我也无法在进度条中设置值
<div id = "progressbar" class="progress progress-striped active" style="display:none"><div id="progress-label" class ="bar">Loading...</div></div>
<script>
$(function() {
var progressbar;
progressbar = $( "#progressbar" ),
progressLabel = $( ".progress-label" );
progressbar.progressbar({
value: false,
change: function() {
progressLabel.text( progressbar.progressbar( "value" ) + "%" );
},
complete: function() {
progressLabel.text( "Complete!" );
}
});
});
var ft = new FileTransfer();
$("#progressbar").show();
ft.onprogress = function(progressEvent) {
perc = Math.floor((progressEvent.loaded / progressEvent.total) * 100);
progressbar.progressbar("value", perc);
}
</script>