网站右侧js图片悬浮窗广告代码 随滚动轴移动

分类:技术 2018年03月02日 00:19:05 2532次浏览 


<script>
lastScrollY=0;
function heartBeat(neryid){
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(neryid).style.top=parseInt(document.getElementById(neryid).style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
}
function hidethis(neryid){
document.getElementById(neryid).style.visibility="hidden";
}
window.setInterval("heartBeat('goods')",1);
</script>
<div id="goods"  style="position:absolute;right: 10px; margin-top: 100px;top: 200px;z-index:999;">
<a href="http://www.6080w.cn/TBHB/" target="_blank"><img src="http://www.6080w.cn/template/ttk/i/img/bbb.png" /></a>
</div>


发表评论