jquery模擬進(jìn)度條實(shí)現(xiàn)方法
本文實(shí)例講述了jquery模擬進(jìn)度條實(shí)現(xiàn)方法。分享給大家供大家參考。具體如下:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>js模擬進(jìn)度條練習(xí)</title> <script type='text/javascript' src="http://xiazai.jb51.net/201508/yuanma/jquery-1.8.0.min.js"></script> <script type='text/javascript' src='http://xiazai.jb51.net/201508/yuanma/jquery.artDialog.js?skin=default'></script> <style> body{ font-size:12px} .aui_nw, .aui_ne, .aui_sw, .aui_se { height: 1px; width: 1px; } .aui_outer, .aui_inner { border: 0; } .aui_state_lock .aui_border { box-shadow: 0 0 10px rgba(0, 0, 0, .8); } </style> </head> <body> <button id="starLoading">顯示進(jìn)度條</button> <div id="msgHtml">http://www.dbjr.com.cn</div> </body> </html> <script> (function(w){ var _html='<div style="line-height: 30px;text-align: center;">正在為您載入數(shù)據(jù),請稍后……</div><div id="jsLoadOuter" style="width:250px;height:8px;border:#6BAAC9 solid 1px; background:#C0EBFF; margin:0 auto;box-shadow: 0 0 3px #2E94BB;padding:1px"><div id="jsLoadInner" style="background:#54AEE0;height:100%;width:0"></div></div>'; var __g; var _maxWidth=100; var _nowWidth=0; var _speed=30; var _step=2; var __time; progress={ render:function(fn){ fn&&fn(_html); _nowWidth=0; __g=document.getElementById('jsLoadInner'); this.fx(); }, complete:function(fn){ clearTimeout(__time); progress.completeFn=fn; this.setOver(); }, setOver:function(){ var _stepa=_step*1.5; if(_nowWidth<_maxWidth){ _nowWidth=_nowWidth-0+_stepa; parseInt(_nowWidth)>parseInt(_maxWidth)?_nowWidth=_maxWidth:''; __g.style.width=''+_nowWidth+'%'; _speed=(_maxWidth-_nowWidth)/1000; __time=setTimeout('progress.setOver()',_speed) ; }else{ clearTimeout(__time); progress.completeFn&&progress.completeFn(); }; }, fx:function(){ var _stepa=_step; if(_nowWidth<_maxWidth-5){ _stepa=_nowWidth>_maxWidth*0.6?(_stepa*0.02):_stepa; _nowWidth=_nowWidth-0+_stepa; parseInt(_nowWidth)>parseInt(_maxWidth)?_nowWidth=_maxWidth:''; __g.style.width=''+_nowWidth+'%'; __time=setTimeout('progress.fx()',_speed); }else{ clearTimeout(__time); }; } } w.progress=progress; })(window) // $(function(){ showLoading(); $('body') .on('click','#starLoading',function(){ showLoading(); }) }) function showLoading(){ //開始顯示進(jìn)度條 progress.render(function(html){ art.dialog({id:"jsLoadingDialog",title:"\u6b63\u5728\u52a0\u8f7d\u4e2d\u2026\u2026",cancel:!1,lock:!0,background:"#fff",fixed:!0,content:html}); }); //請求完成后完成進(jìn)度條,,,模擬10秒后請求完成 setTimeout(function(){ progress.complete(function(html){ art.dialog.list['jsLoadingDialog']&&art.dialog.list['jsLoadingDialog'].close(); $('#msgHtml').html('進(jìn)度條已走完'); }); },10000); }; </script>
運(yùn)行效果如下圖所示:
希望本文所述對大家的jquery程序設(shè)計(jì)有所幫助。
- 自定義刻度jQuery進(jìn)度條及插件
- jQuery實(shí)現(xiàn)文件上傳進(jìn)度條特效
- jQuery實(shí)現(xiàn)的進(jìn)度條效果
- jquery實(shí)現(xiàn)的一個(gè)簡單進(jìn)度條效果實(shí)例
- Jquery Uploadify上傳帶進(jìn)度條的簡單實(shí)例
- Jquery Uploadify多文件上傳帶進(jìn)度條且傳遞自己的參數(shù)
- 6款新穎的jQuery和CSS3進(jìn)度條插件推薦
- 分享8款優(yōu)秀的 jQuery 加載動畫和進(jìn)度條插件
- jquery實(shí)現(xiàn)動畫菜單的左右滾動、漸變及圖形背景滾動等效果
- jquery實(shí)現(xiàn)鼠標(biāo)經(jīng)過顯示下劃線的漸變下拉菜單效果代碼
- jquery實(shí)現(xiàn)模擬百分比進(jìn)度條漸變效果代碼
相關(guān)文章
jQuery實(shí)現(xiàn)選項(xiàng)卡切換效果簡單演示
這篇文章為大家分享了一款jQuery實(shí)現(xiàn)選項(xiàng)卡切換簡單演示效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2015-12-12jquery 插件開發(fā) extjs中的extend用法小結(jié)
在jquery中,extend其實(shí)在做插件時(shí)還是用的比較多的,今天同時(shí)小結(jié)jquery和ext js中的extend用法,有需要的朋友可以參考下2013-01-01jquery判斷checkbox是否選中及改變checkbox狀態(tài)的實(shí)現(xiàn)方法
下面小編就為大家?guī)硪黄猨query判斷checkbox是否選中及改變checkbox狀態(tài)的實(shí)現(xiàn)方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-05-05jQuery實(shí)現(xiàn)鼠標(biāo)經(jīng)過時(shí)高亮,同時(shí)其他同級元素變暗的效果
這篇文章主要介紹了jQuery實(shí)現(xiàn)鼠標(biāo)經(jīng)過時(shí)高亮,同時(shí)其他同級元素變暗的效果,涉及jQuery基于事件響應(yīng)機(jī)制的頁面元素遍歷與屬性變換操作技巧,需要的朋友可以參考下2016-09-09JQuery中基礎(chǔ)過濾選擇器用法實(shí)例分析
這篇文章主要介紹了JQuery中基礎(chǔ)過濾選擇器用法,涉及jQuery屬性選擇及樣式操作的相關(guān)技巧,需要的朋友可以參考下2015-05-05jquery validation插件表單驗(yàn)證的一個(gè)例子
jquery.validate.js validation表單的驗(yàn)證插件2010-03-03jQuery源碼分析-03構(gòu)造jQuery對象-源碼結(jié)構(gòu)和核心函數(shù)
jQuery源碼分析-03構(gòu)造jQuery對象-源碼結(jié)構(gòu)和核心函數(shù),需要的朋友可以參考下。2011-11-11Bootstrap table 實(shí)現(xiàn)樹形表格聯(lián)動選中聯(lián)動取消功能
這篇文章主要介紹了Bootstrap table 實(shí)現(xiàn)樹形表格聯(lián)動選中聯(lián)動取消功能,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-09-09