<!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">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>页面加载进度条</title>
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
var etControl = {};
etControl.process = function (config) {
/*需要放在html中的body标签后面使用本控件*/ var count = 0;
var id = "loading";
var el = "#" + id; $("body").append('<div id="' + id + '"></div>'); var divTxt = "#" + id + " div";
$(el).html("<div></div>");
$(el).attr("style", "width: 100px;height: 12px;background: #A0DB0E;padding: 5px;position: fixed;left: 0;top: 0;font-size:12px;");
$(divTxt).attr("style", "width: 1px;height: 12px;background: #F1FF4D;"); /*更新进度条*/
this.updateProcess = function (percent) {
setTimeout(function () { $(divTxt).animate({ width: percent + "px" }).text(percent + "%") }, ++count * 500);
if (percent == 100) { /*100%就从页面移除loading标签*/
setTimeout(function () {
$(el).hide(500);
setTimeout(function () { $(el).remove() }, 500);
}, count * 500 + 800);
}
};
} </script>
</head>
<body> </body> <script type="text/javascript">
/*需要放在body标签后面,然后在适当的位置调用updateProcess方法*/
var p = new etControl.process();
p.updateProcess(34);
p.updateProcess(57);
p.updateProcess(62);
p.updateProcess(90);
p.updateProcess(100);
</script> </html> 复制过来就是方便自己查看而已 来自http://www.cnblogs.com/timy/archive/2011/12/07/2279200.html
如有版权问题,请联系我删除

js页面加载进度条的更多相关文章

  1. js页面加载进度条(这个就比较正式了,改改时间就完事儿)

    不废话,直接上代码 思路不难,就是一个animate方法配合随机数 duration内个三秒钟,是自定义的,可以改成页面加载时间,这样就完美了 <!doctype html> <ht ...

  2. vue使用nprogress页面加载进度条

    vue使用nprogress页面加载进度条 NProgress是页面跳转是出现在浏览器顶部的进度条 官网:http://ricostacruz.com/nprogress/ github:https: ...

  3. css3 linear-gradient实现页面加载进度条效果

    最终效果图: html结构: <div>    <p class="p1">        <span></span>    < ...

  4. jQuery模拟页面加载进度条

    因为我们无法通过任何方法获取整个页面的大小和当前加载了多少,所以想制作一个加载进度条的唯一办法就是模拟.那要怎么模拟呢? 我们知道,页面是从上往下执行的,也就是说我们可以大致估算出在页面的某个位置加载 ...

  5. ajax页面加载进度条插件

    下面两个都是youtube视频的加载进度条效果的ajax插件 一.官网:http://ricostacruz.com/nprogress/官网 github:https://github.com/rs ...

  6. JS -- 异步加载进度条

    今天在博客园问答里面看到博友问道怎么实现Ajax异步加载产生进度条. 很好奇就自己写了一个. 展现效果: 1) 当点击Load的时候,模拟执行异步加载. 浏览器被遮挡. 进度条出现. 实现思路: 1. ...

  7. 插件二之页面加载进度条pace.js

    关于pace.js pace.js包含14样式,每种样式可以自定义颜色,官方下载中提供了几种颜色的主题,使用方式也很简单,引入pace的js文件跟所需样式文件即可 <link rel=" ...

  8. JS网页加载进度条

    参考:http://www.cnblogs.com/timy/archive/2011/12/07/2279200.html

  9. 自己写的页面加载进度条jquery插件

    (function ($) { var progressId = "progress" + Math.round(Math.random() * 100) var progress ...

随机推荐

  1. PHP 中的注释

    // 这是 PHP 单行注释 /* 这是 PHP 多行 注释 */ <?php $txt1="Learn PHP"; $txt2="w3cschool.cc&quo ...

  2. phpquery笔记

    下载phpquery包 require('phpQuery/phpQuery.php');//加载 for($i=1168;$i<=10000;$i++){ phpQuery::newDocum ...

  3. js实现网页收藏功能,动态添加删除网址

    <html> <head> <title> 动态添加删除网址 </title> <meta charset="utf-8"&g ...

  4. linux 下进程状态及进程控制

    系统状态检测及进程控制1,/proc 是系统的一个窗户,可以透视内核2,建议将hosts里localhost,locahost.locadomain 解析为127.0.0.1 把系统域名解决为局域网的 ...

  5. 查询Sqlserver 表结构信息 SQL

    SELECT 表名 then d.name else '' end, 表说明 then isnull(f.value,'') else '' end, 字段序号 = a.colorder, 字段名 = ...

  6. 鼠标键盘无法进入:(EE) config/hal: couldn’t initialise context: (null)

    vi /var/log/Xorg.0.log 发现有一行:(EE) config/hal: couldn’t initialise context: (null) 在xorg.conf里面加上下面选项 ...

  7. Android 通过外键连接两个数据库

    Learn: 1.Android数据库的语法. 2.通过外键连接两个数据库. 3.加强了对数据库的熟悉度. 4.对文本框的visiblity属性的了解. Demo:http://pan.baidu.c ...

  8. Ubuntu/Linux 笔记应用 为知笔记(支持markdown)

    发现网易云笔记没有Linux,但是为知笔记有Linux版本,且支持markdown格式 sudo add-apt-repository ppa:wiznote-team sudo apt-get up ...

  9. IOS UIlabel设置文本距离边框距离

    自定义UILabel 继承 UILabel 重写drawTextInRect 方法具体如下: CGRect rect = CGRectMake(rect.origin.x + 5, rect.orig ...

  10. pyqt小例子 treewidget

    # -*- coding: cp936 -*- from PyQt4.QtCore import * from PyQt4.QtGui import * class InlineEditor(QWid ...