discuz 发表于 2015-1-25 14:45:45

discuz论坛如何设置滚动广告代码的添加的方法

在适当的位置DIY添加一个静态模块,将以下代码粘贴进去即可,可以自行修改滚动速度、图片宽高。


<div class="ad728">
<style type="text/css">
<!--
#demo {
    background: #FFF;
    overflow:hidden;
    border: 1px dashed #CCC;
    width: 958px;
hight: 200px;
}
#demo img {
    border: 3px solid #F2F2F2;
}
#indemo {
    float: left;
    width: 800%;
}
#demo1 {
    float: left;
}
#demo2 {
    float: left;
}
-->
</style>
<div id="demo">
<div id="indemo">
<div id="demo1">
<!--流动广告代码开始-->
<a href="#" target="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90" alt=""></a>

<atarget="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90"alt="广告招租"></a>

<atarget="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90"alt="广告招租"></a>

<a href="#" target="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90"alt="广告招租"></a>

<atarget="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90"alt="广告招租"></a>

<atarget="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90"alt="广告招租"></a>

<atarget="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90"alt="广告招租"></a>

<!--流动广告代码结束-->
</div>
<div id="demo2">
<!--流动广告代码开始-->
<a href="#" target="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90" alt="广告招租"></a>

<atarget="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90"alt="广告招租"></a>

<atarget="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90"alt="广告招租"></a>

<a href="#" target="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90"alt="广告招租"></a>

<atarget="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90"alt="广告招租"></a>

<atarget="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90"alt="广告招租"></a>

<a href="#" target="_blank"><img src="http://www.miqilian.com/static/image/adimg/zhaozu.jpg" border="0" width="120" height="90" alt="广告招租"></a>


<!--流动广告代码结束-->
</div>
</div>
</div>
<script>
var speed=20; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab.scrollLeft<=0)
tab.scrollLeft+=tab2.offsetWidth ;
else{
tab.scrollLeft--;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {
clearInterval(MyMar)
};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
</script>
</div>


这个就是方法哦,大家可以自己设置下哦
页: [1]
查看完整版本: discuz论坛如何设置滚动广告代码的添加的方法