<!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 src="jquery/jquery-1.3.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
var menuYloc = $("#test").offset().top;
$(window).scroll(function (){
var offsetTop = menuYloc + $(window).scrollTop() +"px";
$("#test").animate({top : offsetTop },{ duration:600 , queue:false });
});
});
</script>
</head>
<body style="height:2000px;">
<div id="test" style="position:absolute; top:100px; left:0;">
跟随屏幕滚动层!
</div>
</body>
</html>
跟随屏幕滚动层
最新推荐文章于 2019-09-09 13:05:45 发布