下面代码实现了一个进度条的效果,其中列举出了一部分的方法
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>滑块效果</title>
<script type="text/javascript" language="javascript" src="../js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" language="javascript" src="../js/jquery-ui-1.8.18.custom.min.js"></script>
<!--引入css样式文件-->
<link rel="stylesheet" href="../css/ui-lightness/jquery-ui-1.8.18.custom.css">
<script type="text/javascript">
$(document).ready(function(){
$("#slider").slider({
//设置滑块是否可拖动,默认为false(可以拖动),true不可以拖动
disabled:false,
//设置滑块是否有动画效果
animate:true,
//滑块的最大值是100
max:100,
//滑块的最小值是0
min:-100,
//滑块默认值
value:0,
//布局方式,默认为水平horizontal,垂直是vertical
orientation:'horizontal',
//多个默认值,初始化滑块的位置
values:[30,80],
//设置可滑动的区间是固定的
range:true,
//采用属性的方式执行绑定事件
stop:function(event,ui){
alert("滑动停止的时候执行");
}
})
//采用绑定的方式执行events事件
$("#slider").bind("slidestart",function(event,ui){
alert("开始执行");
});
});
</script>
</head>
<body>
<div>实现滑块效果</div>
<div id="slider"></div>
</body>
</html>