ecshop模板|仿凡客模板的首页滑动广告
导读:第一步:引入JS,在index.dwt文件的</head>前面添加如下代码:<SCRIPT language=javascript type=text/javascript>var hmax = 340;//最大高度var&n
第一步: 引入JS,在index.dwt文件的</head>前面添加如下代码:
- <SCRIPT language=javascript type=text/javascript>
- var hmax = 340;//最大高度
- var hmin = 100;//最小高度
- var h=0;
- function addCount(){
- {
- h=hmax;
- setTimeout("noneAds()",1000); //停留时间自己适当调整 1000 = 1秒
- document.getElementById("adsOPEN").style.display = "none";
- }
- document.getElementById("ads").style.display = "";
- document.getElementById("ads").style.height = h+"px";
- }
- window.onload = function showAds(){
- document.getElementById("ads").style.display = "none";
- document.getElementById("ads").style.height = "0px";
- addCount(); //慢慢打开
- // h=hmax;
- // setTimeout("noneAds()",1000); //停留时间自己适当调整 1000 = 1秒
- }
- function openAds(){
- h = 0;//高度
- addCount(); //慢慢打开
- }
- function noneAds(){
- if(h>hmin) {
- h -= 5;
- setTimeout("noneAds()",1);
- }
- else {
- h = hmin;
- document.getElementById("ads").style.display = "none";
- document.getElementById("adsOPEN").style.display = "";
- return;
- }
- document.getElementById("ads").style.height = h+"px";
- }
- </SCRIPT>
复制代码 第二步:在index.dwt中,你需要显示广告的位置插入如下代码:
- <DIV id=ads style="OVERFLOW: hidden; TOP: 0px; TEXT-ALIGN: center; margin:10px">
- <IMG src="/images/max.jpg">
- </DIV>
- <DIV id=adsOPEN style="OVERFLOW: hidden; TEXT-ALIGN: center; display:none; margin-top:10px;">
- <IMG src="/images/min.jpg" border=0>
- </DIV>
复制代码 大功告成,因是公司的网站,所以这里就不放演示了,安装成功的留个演示地址
|
| 本文连接地址:http://www.511sj.com/html/wangdianjianshe/ecshop_mobanzhizuo/207.Html |
|