HTML
<div id="follow">
<p>This element will follow all the way down to page</p>
<p></p>
</div>
jQuery的
$(document).ready(function() {
var speed = 1000;
var current_top = parseInt($('#follow').css('top'));
$(window).scroll(function() {
var top = $(window).scrollTop();
$('#follow').css('top', top + current_top);
});
});
CSS
#follow {
position:absolute;
left:10px;
top:10px;
height:50px;
width:100%;
background-color:#f0f0f0;
border:1px solid #404040;
padding:8px;
}
工作演示http://jsfiddle.net/cse_tushar/YpHxd/
欢迎.. !! :) – 2013-05-05 04:05:57