倒计时
(function(){
var time = $('#countdown').data('time');
if (time) {
var curTime = (new Date()).getTime();
var mss = time-curTime;
if(mss){
var intervalTime = 1000
countDown()
setInterval(function(){
mss -= intervalTime
countDown()
},intervalTime)
}else{
$('#countdown').html(0 + " 天 " + 0 + " 小时 " + 0 + " 分" + 0 + " 秒 ")
}
}
function countDown(){
var days = parseInt(mss / (1000 * 60 * 60 * 24));
var hours = parseInt((mss % (1000 * 60 * 60 * 24))/ (1000 * 60 * 60));
var minutes = parseInt((mss % (1000 * 60 * 60))/ (1000 * 60));
var seconds = parseInt((mss % (1000 * 60))/ 1000);
$('#countdown').html(days + " 天 " + hours + " 小时 " + minutes + " 分" + seconds + " 秒 ");
if(days==0&&hours==0&&minutes==0&&seconds==0){
$('#countdown').html(0 + " 天 " + 0 + " 小时 " + 0 + " 分" + 0 + " 秒 ")
}
}
})()