读书人

jquery ui(4)进度条 progressbar

发布时间: 2013-08-10 21:14:06 作者: rapoo

jquery ui(四)进度条 progressbar

进度条可以向用户显示程序当前完成的百分比,让用户知道程序的进度,提高了用户体验。而jquery ui 则提供一个非常便捷的方法实现这一功能,就是progressbar.

一、 老规矩,先上一个简单的例子

1、代码如下:<script type="text/javascript"?src="http://code.jquery.com/jquery-1.9.1.js"></script>?
<script type="text/javascript"?src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link?href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"?rel="stylesheet"?/>
<script type="text/javascript">
? ?$(function()?{
? ? ? $(?"#progressbar1"?).progressbar({value:?7?});
? ??});

</script>
<div id="progressbar1">
<div?class="progress-label">ifxoxo.com..7%</div>
</div>

2、 效果图如下:jquery ui(4)进度条 progressbar

jQuery UI Progressbar ifxoxo

二、具体用法

1、需要加载的js文件

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

<script type="text/javascript"?src="http://code.jquery.com/jquery-1.9.1.js"></script>?
<script type="text/javascript"?src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link?href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"?rel="stylesheet"?/>

2、页面上的html代码

需要一个用来装progressbar的空容器

<div id="divProgerssbar"></div>

3、js代码初始化函数:$(.selecter).progressbar()

(1)options

它有三个参数可以使用

?参数?默认值?作用?value?0?进度条显示的度数(0到100)?max?100?进度条的最大值?disable?false?是否隐藏

(2)事件

读书人网 >Web前端

热点推荐