<!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> Jquery 右侧浮动菜单-www.jb200.com</title>
<style>
.test{ height:8400px;}
.float{ width:103px; height:213px; background: url(images/float.png) no-repeat; overflow:hidden; position:absolute; right:10px; top:100px;}
</style>
<script type="text/
javascript" src="/jquery/1.5.1/jquery.min.js"></script>
</head>
<body>
<div class="test"></div>
<div class="float">aaaa</div>
<script>
$(function(){
$(document).css({position : "relative"})
$(".float").css({position : "absolute",top : "100px",right : "10px"})
$(window).scroll(function(){
rightScroll();
})
function rightScroll(){
var wH = $(window).height(),
eH = $(".float").height(),
sH = $(window).scrollTop();
$(".float").animate({top : (wH-eH)/2+sH},{ queue: false, duration: 900 });
}
})
</script>
</body>
</html>