我做错了什么?
progressbar : function() {
var $progress = $('<div>', {'class' : 'progress-bar', height : '2px'});
var width = 0,
load = 0;
$(document).on({
ajaxSend : function(event, req, set) {
$('body').append($progress);
load = setInterval(function(e) {
if (width > 100) {
clearInterval(load);
}
width++;
$('.progress-bar').width(width + '%');
}, 10);
},
ajaxComplete : function(){
width = 0;
clearInterval(load);
$('body').remove('.progress-bar');
//$('.progress-bar').fadeOut();
}
});
}
fadeOut函数有效但我无法从DOM中删除.progress-bar。我在窗口上调用上面的函数 - load&amp;点击。
答案 0 :(得分:1)
$('body').remove('.progress-bar');
用
替换它$('.progress-bar').remove();
答案 1 :(得分:1)
您必须使用$('.progress-bar').remove()