本文實例講述了jquery-ui 進度條功能。分享給大家供大家參考,具體如下:
<!DOCTYPE html> <html> <head> <meta charset="utf8" /> <title>www.jb51.net progressbar</title> <style type="text/css"> #divprogressbar{ width:300px; height:30px; } .progress-label{ float:left; margin-left:40%; margin-top:3px; } </style> <link rel="stylesheet" href="https://cdn.bootcss.com/jqueryui/1.11.0/jquery-ui.css" rel="external nofollow" media="screen"/> <script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript" src="https://cdn.bootcss.com/jqueryui/1.10.4/jquery-ui.min.js"></script> </head> <body> <div id="divprogressbar"><div class="progress-label">loading...</div></div> <script type="text/javascript"> $(function(){ // var val=0; $('#divprogressbar').progressbar({value:0}); $('#divprogressbar').progressbar({ value:0, change:function(){ $(".progress-label").text($("#divprogressbar").progressbar("value")+"%"); }, complete:function(){ $(".progress-label").text("Complete!"); } }); function progress(){ var val= $('#divprogressbar').progressbar("value") || 0; $('#divprogressbar').progressbar("option","value",val+1); if(val<99) { setTimeout(progress,100); } } setTimeout(progress,1000); } ); </script> </body> </html>
運行效果:
查看文檔:http://jqueryui.com/progressbar/
感興趣的朋友可以使用在線HTML/CSS/JavaScript代碼運行工具:http://tools.jb51.net/code/HtmlJsRun測試上述代碼運行效果。
更多關于jQuery相關內容可查看本站專題:《jQuery頁面元素操作技巧匯總》、《jQuery常見事件用法與技巧總結》、《jQuery常用插件及用法總結》、《jQuery擴展技巧總結》及《jquery選擇器用法總結》
希望本文所述對大家jQuery程序設計有所幫助。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。