//侧栏随动 var rollStart = $(‘.feed-mail‘), //滚动到此区块的时候开始随动 rollSet = $(‘.search,.weibo,.group,.feed-mail,.tags‘); //添加rollStart之前的随动区块 rollStart.before(‘<div class="da_rollbox" style="position:fixed;background-color:#fff;width:inherit;"></div>‘); var offset = rollStart.offset(),objWindow = $(window),rollBox = rollStart.prev(); objWindow.scroll(function() { if (objWindow.scrollTop() > offset.top){ if(rollBox.html(null)){ rollSet.clone().prependTo(‘.da_rollbox‘); } rollBox.show().stop().animate({top:0,paddingTop:15},400); } else { rollBox.hide().stop().animate({top:0},400); } });
jQuery 随滚动条滚动效果 (固定版),布布扣,bubuko.com
原文:http://www.cnblogs.com/songmz/p/3822406.html