摘要:Jquery聚光燈效果
<!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>
<style>
.myblock{
height:100%;
background-color:gray;
position: absolute;
z-index:1000;
top:0;
left:0;
padding:100px 0px 0px 0px;
color:gray;
text-align:center
}
body{
position: absolute;
z-index:0;
height:100%;
width:100%;
}
#pic{width:250px;height:250px;background-color:red;position: absolute;
z-index:1500;display:none;
}
</style>
<script src="jquery-1.2.6.pack.js" ></script>
<script type="text/javascript">
$(document).ready(function() {
block = "<div id=block class=myblock onClick='dis()' > </div>";
$("#show").click(function() {
$(block).appendTo("body");
$("#block").animate({width:'100%',opacity: 0.6}, 0);
$("#pic").show();
});
$("#block").click(function() {
// $(this).remove();
});
});
function dis()
{
$("#block").remove();
$("#pic").hide();
}
</script>
</head>
<body >
<button id="show" >show</button>
<div id="pic" > </div>
</body>
</html>