console
window.onscroll=function() {
var oDiv=document.getElementById('div1');
var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;
startMove(document.documentElement.clientHeight-oDiv.offsetHeight+scrollTop);
}
var timer=null;
function startMove(iTarget) {
var oDiv=document.getElementById('div1');
clearInterval(timer);
timer=setInterval(function() {
var speed;
speed=(iTarget-oDiv.offsetTop)/10;
speed=speed>0?Math.ceil(speed):Math.floor(speed);
oDiv.style.top=oDiv.offsetTop+speed+'px';
},30);
}
<body style="height: 3000px;">
<div id="div1"></div>
#div1 {width: 100px; height: 150px; background: red; position: absolute; bottom: 0; right: 0;}