当前位置:首页 > 网页特效 > 窗口特效 >

很实用的对联广告代码(自适应高度)

时间:2014-06-06 08:17 来源:互联网 作者:源码搜藏 收藏 推荐

运行代码 保存代码 复制代码 提示:您可以先修改部分代码再运行,保存代码功能在Firefox下无效。
很实用的对联广告代码(自适应高度)
  • 很实用的基于JS+CSS+DIV的网页对联广告代码,自适应网页高度,也就是始终保持在一定调试,这款暂时没有关闭功能。
  • <script language="JavaScript" type="text/javascript">
    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*/}
    //alert(diffY);
    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
    ("lovexin12").style.top)+percent+"px";
    lastScrollY=lastScrollY+percent; 
    //alert(lastScrollY);
    }
    suspendcode12="<DIV id=\"lovexin12\" style='left:2px;POSITION:absolute;TOP:120px;'>ad1</div>"
    suspendcode14="<DIV id=\"lovexin14\" style='right:2px;POSITION:absolute;TOP:120px;'>ad2</div>"
    document.write(suspendcode12); 
    document.write(suspendcode14); 
    window.setInterval("heartBeat()",1);
    </script>
由源码搜藏网整理,转载请注明出处https://www.codesocang.com/tx-chuangkou/8405.html

窗口特效下载排行

最新文章