jquery ui進度條 progressbar

dawn009發表於2014-06-24

進度條可以向使用者顯示程式當前完成的百分比,讓使用者知道程式的進度,提高了使用者體驗。而jquery ui 則提供一個非常便捷的方法實現這一功能,就是progressbar.

一、 老規矩,先上一個簡單的例子

1、程式碼如下:

 src="http://code.jquery.com/jquery-1.9.1.js">
 

<link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" />


ifxoxo.com..7%

2、 效果圖如下:

二、具體用法

1、需要載入的js檔案

(1)jquery.js
(2)jquery.ui
(3)jquery.ui的css

&nbsp;src="http://code.jquery.com/jquery-1.9.1.js">
 

<link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" />

2、頁面上的html程式碼

需要一個用來裝progressbar的空容器

3、js程式碼

初始化函式:$(.selecter).progressbar()

(1)options

它有三個引數可以使用

 引數  預設值  作用
 value  0  進度條顯示的度數(0到100)
 max  100  進度條的最大值
 disable  false  是否隱藏

(2)事件

  • create: 載入progressbar的時候此事件將被觸發
  • change: 進度條有改變的時候此事件將被觸發
  • complete: 載入到100的時候此事件將被觸發

4、一個會動的進度條的例項

(1)程式碼如下:



  
  jQuery UI Progressbar - Custom Label
  <
link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  

  

  
  


 
Loading...



(2)截圖


5、其他

1、事件

(1)create 載入progressbar的時候此事件將被觸發
(2)change 進度條有改變的時候此事件將被觸發
(3)complete 載入到100的時候此事件將被觸發

$('.selector').progressbar({
complete: function(event, ui) { alert('has complete!!'); }
});

2、方法

(1) destory 銷燬 .progressbar( “destroy” )
(2) disable 不可用 .progressbar( “disable” )
(3) enable 可用 .progressbar( “enable” )
(4) option 獲取引數 .progressbar( “option”, optionName )
(5) option 設定引數 .progressbar( “otion” , optionName , [value] )
(6) widget 返回這個element .progressbar( “widget” )
(7) value 獲取/設定value .progressbar( “value” , [value] )

//設定進度條新值
$("#divProgressbar").progressbar( "value", 90);
------------&gt>轉載於:http://blog.sina.com.cn/s/blog_a0db295e0100x7jj.html

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29119536/viewspace-1192694/,如需轉載,請註明出處,否則將追究法律責任。

jquery ui進度條 progressbar
請登入後發表評論 登入
全部評論

相關文章