<!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/htmlcharset=UTF-8" />
<title>jquery浮动层</title>
<style type="text/css">
#Float {background-color: #000height: 200pxwidth: 100pxposition: absolutetop: 80pxright: 20px}
</style>
</head>
<script type="text/javascript" src="http://www.codefans.net/ajaxjs/jquery-1.6.2.min.js"></script>
<script language="javascript">
$(document).ready(function(){
$(window).scroll(function (){
var offsetTop = $(window).scrollTop() + 80 +"px"
$("#Float").animate({top : offsetTop },{ duration:500 , queue:false })
})
})
</script>
<body>
<div style="height:2000px"></div>
<div id="Float"></div>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)