蟬知系統如何添加對聯廣告
- 2016-07-11 15:33:00
- GavinHsueh 原創
- 12682
我們來討論下如何在 蟬知系統中添加對聯廣告,比如我現在想在網站首頁添加對聯廣告,隨窗口浮動。
首先將我們做好的對聯廣告圖片上傳到素材里,其鏈接待用。
新建一個HTML區塊,將下面代碼復制進去:
<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:-80px;POSITION:absolute;TOP:20px;'><a href=\"http://www.baidu.com\"><img src=\"/data/source/default/default/ad.jpg\"/></a></div>" document.write(suspendcode12); window.setInterval("heartBeat()",1); </script> <div id="lovexin14" style="right:-80px; position:absolute"> <a ><img src="https://cdn.easycorp.cn/web/data/source/default/default/ad.jpg"/></a> </div>
將上面代碼中的
<a href=\"http://www.baidu.com\"><img src=\"/data/source/default/default/ad.jpg\"/></a>
根據自己的具體情況進行設置。
CSS:
#lovexin12,#lovexin14{ width:120px; height:250px; background-color:#e5e5e5; border:1px solid #ddd; z-index:999; }
然后在布局管理中的首頁上部布局中添加該區塊:
我們來看下效果: