zoukankan
html css js c++ java
数字倒数效果
当页面初步加载时,显示数字滚动。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> <title>test</title> <style type="text/css"> *{ margin:0; padding:0;} body{font:12px/1 arial; background:#3f3f3f;} .num{ 500px; padding:10px 0;border-radius:15px;text-shadow:1px 1px 1px #999; color:#fff;text-align:center; margin:120px auto; font-size:62px; font-weight:bold; border:5px solid #ccc; background:#fff;} .num strong{ font-weight:normal; border:1px solid #ccc; background:#333; padding:0 10px; text-align:center;} </style> </head> <body> <div id="num" class="num" style="display:none;">1000000</div> <script type="text/javascript"> String.prototype.repeat = function(n){ return Array(n + 1).join(this); }; var addFixed = 5, // 单次增加值 node = document.getElementById('num'), emTotal = node && node.innerHTML; function numAnim(){ var len = 1, last = 0, // 最终值 n = 0; // 需要填充的空白0 if(addFixed < emTotal){ // 跳出setTimeout条件 addFixed += Math.ceil((emTotal - addFixed) / 3); len = emTotal.length - (addFixed + '').length; last = n + '' + addFixed; n = '0'.repeat(10).slice(len); if(len == 0){ // 如果等于0后删除首位 last = last.slice(1); } last = last.split(''); last = '<strong>' + last.join('</strong><strong>') + '</strong>'; node.innerHTML = last; } setTimeout(numAnim, 100); } node.style.display = 'block'; numAnim(); </script> </body> </html>
运行代码
查看全文
相关阅读:
一个表缺失索引发的CPU资源瓶颈案例
SQLServer 版本之八大方法搞清 "我是谁"
DBA成长路线
SQL Server2016升级前几点自检
SQL Server 2016白皮书
<译>通过PowerShell工具跨多台服务器执行SQL脚本
/lib64/libc.so.6: version `GLIBC_2.17' not found
/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found
HGT高程数据文件格式解析
DEM高程数据下载资源
原文地址:https://www.cnblogs.com/jikey/p/2736599.html
最新文章
SQL Server AlwaysOn 如何获取 read-only routing URL
SQL Server 分区表上建立ColumnStore Index 如何添加新分区方法与步骤
Ubuntu 16.04 安装 Docker
更新版PowerBI发布了-- Power BI Report Server Update – March 2018
SSRS 数据源访问Cube 无法创建订阅的解决方法
Ubuntu 18.04 启动root账号并授权远程登录
Invoke-ASCmd 部署SSAS database
自动化分析工具PSSDIAG
SQL Server 2012 performance dashboard 安装
SSIS 如何从 Google BigQuery 拉数据到 SQL Server
热门文章
Azure 配置 PostgreSQL streaming replication
SQL Server 定时检查数据库服务器磁盘空间
Linux 和 Windows 之间传送文件
AWS 上快速搭建 Kafka + Confluent
AWS 创建 pem 文件
一款实时性能监测工具
一次性能优化实战经历
一款实用免费的日志自动化分析工具
一款快速识别最慢语句的性能分析工具
一款好用且免费的语句分析工具
Copyright © 2011-2022 走看看