Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ';装载';没有定义_Javascript_Jquery_Jquery Ui - Fatal编程技术网

Javascript ';装载';没有定义

Javascript ';装载';没有定义,javascript,jquery,jquery-ui,Javascript,Jquery,Jquery Ui,我有这段代码来增加jQuery UI progressbar,但当我在Firefox中打开它时,每次运行setInterval函数时,Firebug都会显示一个错误 // show progress on progressbar $(function() { $( "#loading" ).progressbar({ value: 0 }); }); //increment progressbar var progressBar = $('#loading'),

我有这段代码来增加jQuery UI progressbar,但当我在Firefox中打开它时,每次运行setInterval函数时,Firebug都会显示一个错误

// show progress on progressbar
$(function() {
    $( "#loading" ).progressbar({
        value: 0
    });
});

//increment progressbar
var progressBar = $('#loading'),
    width = loading.width();

var interval = setInterval(function() {

width += 1;

loading.css('width', width + '%');

if (width >= 100) {
        clearInterval(interval);
        loadContent();
    }
}, 75);
我从Firebug得到的确切错误是:

loading is not defined
width = loading.width();

试试
$('#加载').css('width',width+'%')。没有定义加载变量。

您仍然需要使用jQuery调用它:

$('#loading').width();
您从未设置变量加载。可以这样做:

var loading = $('#loading');

您声明了
progressBar
,但从未使用过它。 我认为这是一个错误,您需要声明
正在加载

//increment progressbar
var loading = $('#loading'),
width = loading.width();

你能准确地把它贴在我放的地方吗,我有一些问题。谢谢我不太擅长javascript(仍在学习)