【转载】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= ...
随机推荐
- BootStrap之X-editable插件使用
项目背景 刚加入公司的新项目,主要在做开发工作.由于是新手,本周的工作是配合另外一个同事写前台页面.前台框架是Bootstrap,本文主要介绍一下项目需求的一个功能——表格行内编辑事件. 使用X-ed ...
- [翻译]剖析C#中的异步方法
翻译自一篇博文,原文:Dissecting the async methods in C# 有些括号里的是译注或我自己的理解. 异步系列 剖析C#中的异步方法 扩展C#中的异步方法 C#中异步方法的性 ...
- Apache配置转发
第一种: LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_htt ...
- Error:Connection activation failed: No suitable device found for this connection
原文链接: https://blog.csdn.net/baiboya/article/details/80452822 ens33这个网卡一直无法激活,在网上找了半天,找到这个博主的文章,才解决,虽 ...
- TCP之LAST_ACK状态
前提: A:主动关闭: B:被动关闭: A执行主动关闭,发送FIN,B收到FIN,发送ACK,进入CLOSE_WAIT,B发送FIN,进入LAST_ACK等待最后一个ACK到来: 关闭方式: (1) ...
- 套接字之sendmsg系统调用
sendmsg系统调用允许在用户空间构造消息头和控制信息,用此函数可以发送多个数据缓冲区的数据,并支持控制信息:当调用进入内核后,会将用户端的user_msghdr对应拷贝到内核的msghdr中,然后 ...
- 【git】本地git bash连接远程库github
重要参考: https://www.liaoxuefeng.com/wiki/896043488029600 https://segmentfault.com/a/1190000003728094 正 ...
- 有关sublime的一些使用
习惯了vs的快捷键,用sublime的时候始终感觉不太跟手. 点击 “首选项”→“按键绑定-默认” 在新的界面中就可以更改你想要的快捷键了. 1.自动格式化对齐: 查找 "command&q ...
- 一、基础篇--1.2Java集合-Arraylist 与 LinkedList 区别
Arraylist 与 LinkedList 区别 结构上的区别 ArrayList底层实现基于动态数组,LinkedList底层实现基于双向链表. 性能上区别 ArrayList查询快,增删慢 ...
- 从pip+requirements.txt+virtualenv管理依赖到使用pipenv管理依赖-修改布署方式
背景: 已经使用pip+requirements.txt+virtualenv管理了项目一段时间,为了不要每次都 导出依赖(本地),安装依赖(服务器) 现在要使用pipenv来管理项目的依赖关系 思路 ...