当前位置:编程学习 > JAVA >>

实现广告在右边浮动

 

lastScrollY = 0; 

        function heartBeat() { 

            diffY = document.body.scrollTop; 

            percent = .1 * (diffY - lastScrollY); 

            if (percent > 0) percent = Math.ceil(percent); 

            else percent = Math.floor(percent); 

//right是浮动层的id 

            document.all.right.style.pixelTop += percent; 

            lastScrollY = lastScrollY + percent; 

        } 

     

        window.setInterval("heartBeat()", 1);   

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,