日期:2014-05-17 浏览次数:20443 次
lastScrollY=0; function heartBeat(){ var diffY; if (document.documentElement && document.documentElement.scrollTop) diffY = document.documentElement.scrollTop; else if (document.body) diffY = document.body.scrollTop else {/*Netscape stuff*/} percent=.1*(diffY-lastScrollY); if(percent>0)percent=Math.ceil(percent); else percent=Math.floor(percent); document.getElementById("lovexin12").style.top=parseInt(document.getElementById ("lovexin12").style.top)+percent+"px"; document.getElementById("lovexin14").style.top=parseInt(document.getElementById ("lovexin14").style.top)+percent+"px"; lastScrollY=lastScrollY+percent; } window.setInterval("heartBeat()",1);
<script src="/js/dui.js" type="text/javascript"></script> <div id="lovexin12" style='left: 5px; position: absolute; top: 20px; display: none'> </div> <div id="lovexin14" style='right: 5px; position: absolute; top: 20px;'> </div>