js核心代码
= 300 ) {
top_div.style.display = "block";
} else {
top_div.style.display = "none";
}
}
var ptt=20;
function pageScroll() {
document.getElementById('flypig').style.display='block';
window.scrollBy(0,-10); //每次上升10px
if(document.body.scrollTop==0) {
document.getElementById('flypig').style.marginBottom=ptt+'px';
ptt=ptt+10;
}
scrolldelay = setTimeout('pageScroll()',2); //2毫秒重复执行一次
if(ptt>=1000){
ptt=0;
document.getElementById('flypig').style.marginBottom=20+'px';
document.getElementById('flypig').style.display='none';
clearTimeout(scrolldelay);
}
//pageScroll ends
}
html