我做错了什么?
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。我调用上述函数的窗口加载和点击。
发布于 2017-11-17 06:33:03
你必须使用$('.progress-bar').remove()
发布于 2017-11-17 06:32:16
$('body').remove('.progress-bar'); 将此替换为
$('.progress-bar').remove();https://stackoverflow.com/questions/47344559
复制相似问题