不经过悉心栽培,花儿开不出鲜艳的花朵;不经过时间的历练,幼苗长不成参天大树。

抢购倒计时js特效

web 建伟 186℃ 0评论

 

 

 

 

 

直接上代码示例

//html部分
<div data-v-a99540b0 class="time" >
 <span data-v-a99540b0></span><span data-v-a99540b0></span><span data-v-a99540b0></span>
</div>
//js部分
<script>
 let countDown = +'83017';
 let _int = setInterval(function(){
 let hours = Math.floor(countDown/60/60),
 minute = Math.floor((countDown - hours*3600)/60),
 second = countDown - (hours*3600 + minute*60),
 day = 0;
 _hours = ('00'+hours).slice(-2);
 _minute = ('00'+minute).slice(-2);
 _second = ('00'+second).slice(-2);
 let _cel = `<span data-v-a99540b0>${_hours}</span><span data-v-a99540b0>${_minute}</span><span data-v-a99540b0>${_second}</span>`;
 if(hours > 72){
 day = Math.floor(hours/24);
 hours = hours%24;
 _day = ('00'+day).slice(-2);
 _cel = `<span data-v-a99540b0>${_hours}</span><span data-v-a99540b0>${_minute}</span><span data-v-a99540b0>${_second}</span>`;;
 }
 if(day > 30){
 clearInterval(_int);return false;
 }
 $('.time').html(_cel);
 countDown--;
 },1000);
 </script>

转载请注明:Li Jianwei's Blog » 抢购倒计时js特效

喜欢 (0)or分享 (0)
web技术交流群
22765697