This was first made and is now in xml format.
The Code is as follows:
jquery
jquery的核心库
http://docs.jquery.com
jquery.ui.core
jquery.ui的核心库
http://jqueryui.com/demos
<BR>进度条用来设计展现当前一个进度的完成百分比. 进度条的长度在满足默认父容器情况下可以通过CSS灵活改变. <BR>该进度条是一个精确的精度条, 也就是说需要在系统能够保证精确改变当前完成状态时使用.如果不能计算到精确的完成百分比状态, 模糊的进度条(很快会加入)或spinner animation可以带来更好的用户体验 <BR>
用来设置进度条初始化时候的完成比.
初始化
$('.selector').progressbar({value: 37});
获取属性值
var value = $('.selector').progressbar('option', 'value'); <BR>
设置属性值
$('.selector').progressbar('option', 'value', 37);
processbar的value发生改变
原生的浏览器事件.
JQuery的ui对象
类型: progressbarchange
初始化时设置事件
<BR>$("#progressbar").progressbar({ <BR>change: function(event, ui) { <BR>//this等价于event.target <BR>alert('又完成了1%'); <BR>} <BR>}); <BR>
动态的绑定事件. 动态绑定时候, 使用的事件名就是事件的类型.
<BR>$("#progressbar").bind('progressbarchange', function(event, ui) { <BR>//this等价于event.target <BR>alert('又完成了1%'); <BR>}); <BR>
完全移除一个进度条控件, 使其回退到该元素被初始化成进度条控件之前的状态.
$("#progressbar").progressbar('destroy');
将可进度条控件样式改变成为失效, 与enable对应.
$(".selector").progressbar('disable');
将进度条控件样式改变为允许, 与disable对应.
$(".selector").progressbar('enable');
选项一节中列举的所有选项名都可用
该选项可以接受的任意数据值.
获取或设置进度条控件的选项, 第二个参数是选项名, 第三个参数是值. 如果不指定值, 就是获取, 指定值, 就是设置.
$(".selector").progressbar('option', optionName[, value]);
获取或设置进度条控件的当前value值
$(".selector").progressbar('value'[, value]);
<BR>普通的主题更改可以通过JQuery的在线主题定制方便的选定. <BR>完全的自定义主题:ui.progressbar.css <BR>ui-progressbar: 影响进度条容器样式 <BR>ui-progressbar-value: 影响进度条自身样式. <BR>
<BR>译者注: 将下面的代码直接作为一个HTML文档运行, 就可以明白它是怎么工作的了. <BR>
<BR><!doctype html> <BR><html lang="en"> <BR><head> <BR><title>jQuery UI Progressbar - Default functionality</title> <BR><link type="text/css" href="../../themes/base/ui.all.css?6.1.3" rel="stylesheet" /> <BR><script type="text/javascript" src="../../jquery-1.3.2.js?6.1.3">《script》 <BR><script type="text/javascript" src="../../ui/ui.core.js?6.1.3">《script》 <BR><script type="text/javascript" src="../../ui/ui.progressbar.js?6.1.3">《script》 <BR><link type="text/css" href="../demos.css?6.1.3" rel="stylesheet" /> <BR><script type="text/javascript"> <BR>$(function() { <BR>var current_value = 0; <BR>change = function() { <BR>$("#progressbar").progressbar('option', 'value', current_value); <BR>current_value ++; <BR>if(current_value <= 100) { <BR>setTimeout('change()', 200); <BR>} <BR>}; <BR>progressbar_dynamic = function() { <BR>progressbar_init(); <BR>change(); <BR>}; <BR>progressbar_init = function() { <BR>$("#progressbar").progressbar({ <BR>value: current_value, <BR>change: function(event, ui) { <BR>$('#number').text($(this).progressbar('option', 'value')); <BR>document.getElementById('number').style.position = 'relative'; <BR>document.getElementById('number').style.left = $(this).progressbar('option', 'value') * ($('.ui-progressbar').width() / 100) - 5; <BR>} <BR>}); <BR>}; <BR>progressbar_destroy = function() { <BR>$("#progressbar").progressbar('destroy'); <BR>}; <BR>progressbar_disable = function() { <BR>$("#progressbar").progressbar('disable'); <BR>}; <BR>progressbar_enable = function() { <BR>$("#progressbar").progressbar('enable'); <BR>}; <BR>progressbar_option = function() { <BR>var option_name = $('#option_name').val(); <BR>var option_value = $('#option_value').val(); <BR>if(option_value) { <BR>$("#progressbar").progressbar('option', option_name, option_value); <BR>} else { <BR>$('#option_value').val($("#progressbar").progressbar('option', option_name)); <BR>} <BR>}; <BR>progressbar_value = function() { <BR>var value_value = $('#value_value').val(); <BR>if(value_value) { <BR>$("#progressbar").progressbar('value', value_value); <BR>} else { <BR>$('#value_value').val($("#progressbar").progressbar('option', 'value')); <BR>} <BR>}; <BR>}); <BR>《script》 <BR><style type="text/css"> <BR>input{height: 22px; margin: 1px 2px;} <BR>input[type=button]{border: none; width: 80px;} <BR>input[type=text]{border: 1px solid #BBBBBB; line-height: 20px;} <BR>#number{width: 5px;} <BR></style> <BR></head> <BR><body> <BR><br /><br /> <BR><p id="number"> </p> <BR><p id="progressbar"></p> <BR><br /><br /> <BR><input type="button" value="init" onclick="progressbar_init();" /> <BR> <BR><input type="button" value="destroy" onclick="progressbar_destroy();" /> <BR> <BR><input type="button" value="disable" onclick="progressbar_disable();" /> <BR> <BR><input type="button" value="enable" onclick="progressbar_enable();" /> <BR> <BR><input type="button" value="dynamic" onclick="progressbar_dynamic();" /> <BR><br /> <BR><input type="button" value="option" onclick="progressbar_option();" /> <BR>选项名: <input type="text" id="option_name" /> <BR>选项值: <input type="text" id="option_value" /> <BR><br /> <BR><input type="button" value="value" onclick="progressbar_value();" /> <BR>完成度: <input type="text" id="value_value" /> <BR><br /> <BR><hr /> <BR>init: 初始化一个进度条 <BR>destroy: 销毁进度条 <BR>disable: 失效 <BR>enable: 有效 <BR>dynamic: 一个模拟的动态加载效果 <BR>option: 测试option方法 <BR>value: 测试value方法 <BR></body> <BR></html> <BR>
<BR>progressbar是一个用value来控制显示进度条的插件, 最关键的地方在于value属性和value方法. 用自己的程序控制改变value以显示当前进度.. <BR>
Save as an xml file. Pay attention to encoding conversion.