為什么彈出框只能彈一次,刷新再能彈下一次if($("#" + i).val()==""||$("#" + i).val()==null||$("#" + i).val()==undefined){// alert(stus[i]+'不能為空');var _this = stus[i]+'不能為空';var str='';// console.log(_this);var this_sec = 3000;if (_this){str+="<p>"+_this+"</p>";$('.toast').append(str);$('.toast').fadeIn();}setTimeout(function () {
$('.toast').fadeOut(function () {
$(this).remove();
});
_this = '';
},1000);
}
2 回答

蝴蝶刀刀
TA貢獻(xiàn)1801條經(jīng)驗(yàn) 獲得超8個(gè)贊
你都remove了它下次怎么彈,你在setTimeout的第一行打日志你會(huì)發(fā)現(xiàn)setTimeout會(huì)一直執(zhí)行,但是你的fadeOut只會(huì)執(zhí)行一次,因?yàn)楫?dāng)前執(zhí)行這個(gè)動(dòng)畫的對象,在執(zhí)行動(dòng)畫以后被你remove了
- 2 回答
- 0 關(guān)注
- 792 瀏覽
添加回答
舉報(bào)
0/150
提交
取消