随滚动条滚动的jquery效果[转自:大前端]

$(function(){
	var rollStart = $('#recent-comments-4'), //滚动到此区块的时候开始随动
		rollOut = $('.cookie-list'); //隐藏rollStart之后的区块

	rollStart.before('<div class="da_rollbox"></div>');

	var offset = rollStart.offset(),objWindow = $(window),rollBox = rollStart.prev(),
		rollSet = $('#text-3,#recent-comments-4,#recent-posts-3'); //添加rollStart之前的随动区块

	objWindow.scroll(function() {
		if (objWindow.scrollTop() > offset.top){
			if(rollBox.html(null)){
				rollSet.clone().prependTo('.da_rollbox');
			}
			rollOut.fadeOut();
			rollBox.show().stop().animate({marginTop: objWindow.scrollTop() - offset.top + 20},400);
		} else {
			rollOut.fadeIn();
			rollBox.hide().stop().animate({marginTop:0},400);
		}
	});
})

原文url:http://www.daqianduan.com/jquery-roll/