<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8"/>
<title>生成一个倒计时效果</title>
<style type="text/css">
body{
margin:0;
padding:0;
background: orange;
width: 100%;
height: 100%;
font-size: 5em;
color: #fff;
text-align:center;
font-family: 'microsoft yahei',Arial,sans-serif;
}
.countdown{
position: absolute;
top:50%;
left:50%;
transform: translate(-50%,-50%);
-webkit-transform: translate(-50%,-50%);
}
</style>
<script type="text/javascript" src="../js/jquery-1.11.0.js"></script>
<script type="text/javascript">
$(function() {
var $countdown = $('.countdown'),
number = $countdown.html() * 100 / 100;
//number = parseInt($countdown.html());
var countdownInterval = window.setInterval(function() {
number--;
if (number == 0) {
$countdown.html("你好,涂传龙");
window.clearInterval(countdownInterval);
} else {
$countdown.html(number);
}
}, 1000);
});
</script>
</head>
<body>
<div class="countdown">
60
</div>
</body>
</html>

[jQuery编程挑战]006 生成一个倒计时效果的更多相关文章

  1. [jQuery编程挑战]003 克隆一个页面元素及其相关事件

    挑战: a) 绑定一个点击方法到这个div,点击后此元素会淡出消失 b) 同时克隆一个新的div元素到页面,元素内容是前面div文字内容反向书写(即,sgatbg olleh),同样也具有上面的点击事 ...

  2. [jQuery编程挑战]008 生成逗号分隔数字

    <!DOCTYPE html> <html lang="zh"> <head> <meta charset="utf-8&quo ...

  3. jQuery实现的手机发送验证码倒计时效果代码分享

    这是一款基于jquery实现的手机发送验证码倒计时效果代码,可实现实时显示秒数倒计时的功能,还可实现对手机号码格式验证的功能,是一款常用的网站注册发送手机验证码特效代码. 效果描述:注册一个网站,当需 ...

  4. [jQuery编程挑战]001:实现页面元素加速动画效果

    要求: 页面包含两个HTML元素:一个按钮,一个小方块 动画要求:点击按钮,小方块从页面坐标300,300,加速移动到0,0 相关知识点: jQuery动画方法animate easing参数的设置 ...

  5. [jQuery编程挑战]002:实现一个转盘大抽奖

    body { background-color: #F2F2F2; text-align: center; } .container { position: relative; width: 500p ...

  6. 【WorkTile赞助】jQuery编程挑战#009:生成两个div元素互相追逐的动画

    HTML页面: <!-- HTML代码片段中请勿添加<body>标签 //--> <div id="container"> <div id ...

  7. jquery 实现 点击按钮后倒计时效果,多用于实现发送手机验证码、邮箱验证码

    原文链接:http://www.cnblogs.com/steed-zgf/archive/2012/02/03/2336984.html <!DOCTYPE html PUBLIC " ...

  8. [jQuery编程挑战]007 切换数据表格的行列

    <!DOCTYPE html> <html lang="zh"> <head> <meta charset="utf-8&quo ...

  9. [jQuery编程挑战]005 使用最短的代码生成元素的闪烁效果

    <!DOCTYPE html> <html lang="zh"> <head> <meta charset="utf-8&quo ...

随机推荐

  1. 待解决)leetcode 路径和 dfs 线序遍历

    Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given su ...

  2. 2013=7=29 nyist 13题

    Fibonacci数 时间限制:3000 ms  |  内存限制:65535 KB 难度:1 描述 无穷数列1,1,2,3,5,8,13,21,34,55...称为Fibonacci数列,它可以递归地 ...

  3. UVa 10029 hash + dp

    题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  4. Please check if the Publishing Tools on the server (System/PublishingTools) are started.

    ArcMap或ArcCatalog中双击连接到Server即可,该工具即自动可启动

  5. php中strlen和{}的效率对比

    很少有人知道{}用来判断字符串长度 今天试试 发现好像没有strlen快

  6. CSS3动画变形Animations

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. 源文件名和public 类名

    问题: 源文件名和类名不一样 解决方法:将源文件的文件名test修改成Test 

  8. 【LeetCode】Best Time to Buy and Sell Stock

    Say you have an array for which the ith element is the price of a given stock on day i. If you were ...

  9. div+css3列布局,带详尽注释

    直接看代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...

  10. [Javascript] Modifying an Immutable.js Map()

    We will now look at five methods that modify an Immutable.Map(). set update delete clear merge //set ...