【转载】jquery版的网页倒计时效果
<!doctype html>
<html> <head>
<meta charset="utf-8">
<title>jquery版的网页倒计时效果</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" name="viewport" id="viewport">
<meta name="format-detection" content="telephone=no" />
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<style type="text/css">
.time-item strong {
background: #C71C60;
color: #fff;
line-height: 49px;
font-size: 36px;
font-family: Arial;
padding: 0 10px;
margin-right: 10px;
border-radius: 5px;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
} #day_show {
float: left;
line-height: 49px;
color: #c71c60;
font-size: 32px;
margin: 0 10px;
font-family: Arial, Helvetica, sans-serif;
} .item-title .unit {
background: none;
line-height: 49px;
font-size: 24px;
padding: 0 10px;
float: left;
}
</style>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
var endTime = '2020/07/13 23:59:59';
var end_time = new Date(endTime);
var now = parseInt(new Date().getTime()/1000);
var end = parseInt(end_time.getTime() / 1000);
var intDiff = end - now;
// var intDiff = parseInt(30); //倒计时总秒数量 function timer(intDiff) {
window.setInterval(function() {
var day = 0,
hour = 0,
minute = 0,
second = 0; //时间默认值
if (intDiff > 0) {
day = Math.floor(intDiff / (60 * 60 * 24));
hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
}
if (minute <= 9) minute = '0' + minute;
if (second <= 9) second = '0' + second;
$('#day_show').html(day + "天");
$('#hour_show').html('<s id="h"></s>' + hour + '时');
$('#minute_show').html('<s></s>' + minute + '分');
$('#second_show').html('<s></s>' + second + '秒');
intDiff--;
}, 1000);
} $(function() {
timer(intDiff);
});
</script>
</head> <body>
<div class="time-item">
<span id="day_show">0天</span>
<strong id="hour_show">0时</strong>
<strong id="minute_show">0分</strong>
<strong id="second_show">0秒</strong>
</div>
</body> </html>
效果

【转载】jquery版的网页倒计时效果的更多相关文章
- jquery版的网页倒计时效果
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- jquery网页倒计时效果,秒杀,限时抢购!
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- [转载]jquery版小型婚礼(可动态添加祝福语)
原文链接:http://www.cnblogs.com/tattoo/p/3788019.html 前两天在网上不小心看到“js许愿墙”这几个字,我的神经就全部被调动了.然后就开始我 的百度生涯,一直 ...
- jQuery CircleCounter的环形倒计时效果
在线演示1 本地下载 使用jQuery插件CircleCounter生成的环形倒计时效果,这个插件使用HTML5画布生成动画效果,还不错,大家可以试试! 顺带手录制了个代码,大家不吝赐教:http:/ ...
- jquery网页倒计时效果,秒杀
function FreshTime(){ var endtime=new Date('2019-4-12 18:00:00');//结束时间 var nowtime = new Date();//当 ...
- 【jquery插件】-网页下雪效果
又到了年底,从圣诞节开始,可以发现各大网站的活动是越来越多,都变的银装素裹,本人由于业务需求也需要做这么一个效果,所以就通过google大神找了一下相关资源,结果就出现了N种雪花效果的方式.种 ...
- 【jQuery】手机验证码倒计时效果
<ul class="ulist"> <li class="group"> <label class="label&qu ...
- javascript实现网页倒计时效果
一.HTML代码如下: <div class="timer" id="timer"> <span style="color: bla ...
- jquery页面多个倒计时效果
<div class="timeBox" data-times="2019/06/30,23:59:59"> 距结束 <span class= ...
随机推荐
- 上一个树形菜单的改进,增添了数据绑定功能而非仅仅的jq特效
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>& ...
- sqli-labs(41) and 两php函数的讲解
0X01 构造闭合 发现 不需要闭合 直接构造 id=- union ,database(), 成功 注入 0X02 堆叠注入同道理 一样的 这里我们来了解一下这个函数 mysqli_multi_qu ...
- 【Python】学习笔记一:Hello world
前言 在我看来,无论我们学习什么语言第一个学习的估计都是Hello world,那么接下来就从Hello world说起! 编写代码 我在本机上已经安装了pycharm,所以我所编辑的代码都是在pyc ...
- 教材代码完成情况测试P186(课上测试)
一.任务详情 0 在Ubuntu中用自己的有位学号建一个文件,教材p186 Example8_8 1.修改p186 Example8_8中代码,密钥password不用手动输入,使用Random产生随 ...
- lyf基础作业
include <stdio.h> include <stdlib.h> int main (void) { FILE * fp; int a[10]; int max=0; ...
- How to correctly use preventDefault(), stopPropagation(), or return false; on events
How to correctly use preventDefault(), stopPropagation(), or return false; on events I’m sure this h ...
- mysql5.7.25搭建mysql-5.7.25.tar.gz包(亲验)
STEP 1. 下载 去往官方下载MySQL包.http://dev.mysql.com mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz STEP 2. 解压缩 ...
- 集合(Java总结一)
一.Queue 一个队列就是一个先入先出(FIFO)的数据结构 1.没有实现的阻塞接口的LinkedList: 实现了java.util.Queue接口和java.util.AbstractQueue ...
- python接口测试之mock(二)
上一篇对mock-server已经做了初步的介绍,今天这里继续接着之前的介绍进行,我们先看之前的mock-server部分,之前编写了一个登录的mock,具体json文件见如下的内容: 小王子1110 ...
- iframe嵌套的页面之间传值问题
项目中很多时候会遇到需要用 iframe 嵌套页面的情况.有时候会有这样的需求: iframe 嵌套的页面 A ,点击之后要跳到页面 B ,但是同时还需要 A 页面中的某个属性值. 此时可以先把 A ...