效果:
js:
//彈出窗,三秒倒計時
countdown(){
//點擊發布按鈕后,三秒倒計時開始
$(".btn-pub").click(function(){
var count=3;
var timer = setInterval(function() {
count--;
if(count<0){
return;
}
$(".timeover")[0].innerHTML=count;
}, 1000)
setTimeout(function () {
clearInterval(timer)
timer = null;
},3000)
$(".timeover")[0].innerHTML=3; //每次點擊進去的初始數字是3
//三秒后,彈窗自動關閉
setTimeout(function(){
// console.log(565)
$(".publish").hide();
$(".popwindow").css({
"background": "rgba(0,0,0,0)",
"transform":"scale(0)"
})
$(".pop").css({
"opacity":0,
"transform":"scale(0)"
})
},3000)
})
}