<!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" />
<script type="text/
javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
//jquery进度条关键代码
$(document).ready( function() {
$('.taskBox').delegate('.taskBoxLinks','mousemove',function(e){
var $mouse = e.pageX - $(this).offset().left;
var $span = Math.round($mouse/22.5)*10;
$(this).find('h4').stop().animate({width:$span+'%'},50);
$(this).next('span').text($span+'%');
}).delegate('.taskBoxLinks','mouseleave',function(){
$(this).find('h4').stop().animate({width:'10%'},50);
var $mousex = $(this).find('h3').width();
var $spanx = Math.round($mousex/22.5)*10;
if($spanx==100){
$(this).next('span').text('进度完成')
}else{
$(this).next('span').text($spanx+'%');
}
}).delegate('.taskBoxLinks','click',function(e){
var $mouse = e.pageX - $(this).offset().left;
var $span = Math.round($mouse/22.5)*10;
$(this).find('h3').stop().animate({width:$span+'%'},100);
if($span==100){
$(this).next('span').text('进度完成')
}
});
});
</script>
<title>jquery进度条</title>
<style type="text/css">
body,td,th {
font-family: Verdana, Geneva, sans-serif;
font-size: 12px;
}
h1{ font-size:16px; color:#999; font-weight:normal; text-align:center;
line-height:90px; border-top:1px dashed #ddd; margin-top:50px;}
*{ margin:0; padding:0;}
.taskBoxLinks { float:left; width:225px; height:7px; font-size:0; line-height:0; background:#f2f2f2; border:1px solid #dedede;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px; position:relative; margin-top:8px; margin-right:10px; cursor:pointer;}
.taskBoxLinks h3,.taskBoxLinks h4{ position:absolute; left:-1px; top:-1px; height:7px; font-size:0; line-height:0; width:10%; background:#a3d9f4; border:1px solid #187aab; -moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px; z-index:99;}
.taskBoxLinks h4 { border:1px solid #91cdea; background:#f5fafc; z-index:88;}
.taskBox { width:360px; margin:40px auto; color:#666;}
</style>
</head>
<body>
<div class="taskBox">
<div class="taskBoxLinks"><h3 style="width:10%;"></h3><h4></h4></div>进度<span>10%</span>
</div>
<div class="taskBox" style="padding-left:100px;">
<div class="taskBoxLinks"><h3 style="width:60%;"></h3><h4></h4></div>进度<span>60%</span>
</div>
<div class="taskBox">
<div class="taskBoxLinks"><h3 style="width:20%;"></h3><h4></h4></div>进度<span>20%</span>
</div>
<h1>by <a href="http://www.jb200.com">www.jb200.com</a></h1>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=GBK"/>
<script type="text/javascript" src="./jquery-1.4.4.js"></script>
<style type="text/css">
.divv
{
position:absolute;
top:30%;
left:30%;
width:80px;
height:60px;
border:1px solid #666;
background-color:#9CF;
text-align:center;
display:none;
z-index:300;
}
.popup
{
border:1px solid red;
position:absolute;
top:0px;
left:0px;
width:100%;
height:100%;
background-color:#000;
filter:alpha(opacity=45);
opacity:0.45;
display:none;
z-index:200;
}
.fff
{
border:1px solid blue;
position:relative;
background-color:#000;
}
</style>
<script type="text/javascript">
//jquery进度条代码
$(document).ready(
function(){
//页面初始化
goCenter();
//滚动条滚动
$(window).scroll(
function(){
goCenter();
}
);
//拖动浏览器窗口
$(window).resize(
function(){
goCenter();
}
);
//锁屏
$("#lockButton").click(
function(){
$("#popupDiv").show();
$("#alertDiv").show();
}
);
//解屏
$("#unlockButton").click(
function(){
$("#popupDiv").hide();
$("#alertDiv").hide();
}
);
}
);
function goCenter()
{
var h = $(window).height();
var w = $(window).width();
var st = $(window).scrollTop();
var sl = $(window).scrollLeft();
$("#popupDiv").css("width", w+sl);
$("#popupDiv").css("height", h+st);
$(".divv").css("top", ((h-60)/2)+st);
$(".divv").css("left", ((w-80)/2)+sl);
}
</script>
</head>
<body bgcolor="#FFFFFF">
<select name="sdfas">
<option value="a">aaa</option>
<option value="b">bbb</option>
</select>
<input type="button" value="锁屏" id="lockButton"/>
<div class="popup" id="popupDiv">
<!--IE6下,DIV默认不能遮盖select标签,可在此处放置一个iframe,以达到遮盖效果,其他浏览器可以不要-->
<iframe frameborder="1" scrolling="no" height="100%" width="100%" class="fff"></iframe>
</div>
<div class="divv" id="alertDiv">
<input type="button" value="关闭" id="unlockButton"/>
</div>
</body>
</html>