<section class="the_body">
<div class="countdown">
<h3>距中国雄于地球之日还有</h3>
<div class="countdown_time">
<span class="the_days"><i>0</i><i>3</i></span>
<i class="date_text">天</i>
<span class="the_hours"><i>0</i><i>7</i></span>
<i class="date_text">时</i>
<span class="the_minutes"><i>4</i><i>7</i></span>
<i class="date_text">分</i>
<span class="the_seconds"><i>1</i><i>1</i></span>
<i class="date_text">秒</i>
</div>
</div>
</section>
.the_body{width: 100%;max-width: 640px;min-width: 320px;margin: 0 auto;}
.countdown{background:#ffec20;padding: 10px 0;}
.countdown h3{margin:0;padding:5px 0;color:#f53544;text-align:center;font-size:14px;}
.countdown .countdown_time{display:block;width:100%;text-align:center;}
.countdown .countdown_time i{display:inline-block;position:relative;padding:0 3px;font-style:normal;background:#fff;
margin:0 2px;border-radius:3px;box-shadow:0px 1px 1px #ccc;border-bottom:1px solid #cfcfcf;font-weight
:bold;}
.countdown .countdown_time i:after{content:"";width:100%;border:1px solid #cfcfcf;border-width:1px 0 0;position:absolute;
bottom:1px;left:0;}
.countdown .countdown_time i:before{content:"";width:100%;border:1px solid #cfcfcf;border-width:1px 0 0;position:absolute;
bottom:3px;left:0;}
.countdown .countdown_time .date_text{background:transparent;font-weight:bold;box-shadow:none;
border-bottom:none;text-decoration:none;padding: 0;}
.countdown .countdown_time .date_text:after{content:"";border:none;}
.countdown .countdown_time .date_text:before{content:"";border:none;}
<script>
function remaintime() {
var date = new Date("Jan 1,2015 00:00:00");//设置倒计时结束时间
var nowdate = new Date();//获取当前日期
var remaintime = date.getTime() - nowdate.getTime();//获取现在到倒计时结束时间的毫秒数
var remainday = Math.floor(remaintime / (1000 * 60 * 60 * 24));//计算求得剩余天数
var remainhour = Math.floor((remaintime - remainday * 1000 * 60* 60 * 24)/ (1000 * 60 * 60));//计算求得剩余小时数
var remainminute = Math.floor((remaintime - remainday * 1000 * 60* 60 * 24 - remainhour * 1000 * 60 * 60)/ (1000 * 60));//计算求得剩余分钟数
var remainsecond = Math.floor((remaintime - remainday * 1000 * 60 * 60 * 24- remainhour * 1000 * 60 * 60 - remainminute *
1000 * 60) / (1000));//计算求得剩余秒数
//当剩余天数小于10时,就在其前加一个0,以下剩余小时数、分钟数与秒数与此相同
if (remainday < 10) {
remainday = "0" + remainday;
}else{remainday+="";
//当剩余天数大于10时,剩余天数为数值,这是需要将该值转换为字符串,以下的剩余小时数、分钟数与秒数与此相同
}
if (remainhour < 10) {
remainhour = "0" + remainhour;
}else{remainhour+="";}
if (remainminute < 10) {
remainminute = "0" + remainminute;
}else{remainminute+="";}
if (remainsecond < 10) {
remainsecond = "0" + remainsecond;
}else{remainsecond+="";}
$(".the_days i:first-child").html(remainday.substr(0, 1));
$(".the_days i:last-child").html(remainday.substr(1, 2));
$(".the_hours i:first-child").html(remainhour.substr(0, 1));
$(".the_hours i:last-child").html(remainhour.substr(1, 2));
$(".the_minutes i:first-child").html(remainminute.substr(0, 1));
$(".the_minutes i:last-child").html(remainminute.substr(1, 2));
$(".the_seconds i:first-child").html(remainsecond.substr(0, 1));
$(".the_seconds i:last-child").html(remainsecond.substr(1, 2));
setTimeout("remaintime()",1000);//设置1秒后调用remaintime函数
}
remaintime();
setTimeout(function(){$(".countdown").hide();},10000);//在首页设置的弹窗效果,在分页这段代码可以不设置
</script>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有