你现在的位置:首页 > PHP网站建设知识库 > phpcms > 正文

一个phpcms v9真正可用的首页图片无缝隙滚动代码

左滚动
<div class="box">
<div id="jsweb8_cn_right" style="overflow:hidden;width:740px;">

<table cellpadding="0" cellspacing="0" border="0">

<tr><td id="jsweb8_cn_right1" valign="top" align="center">

<table cellpadding="4" cellspacing="0" border="0">
    {pc:content  action="position" posid="12" thumb="1" order="listorder DESC" num="10"}
<tr align="center">
  {loop $data $r}
<td><div class="img-wrap">
                        <a href="{$r[url]}" title="{$r[title]}"><img src="{thumb($r[thumb],180,160)}" title="{$r[title]}"/></a>
                    </div>
                    <a href="{$r[url]}" title="{$r[title]}">{str_cut($r[title],20)}</a></td>
  {/loop}
</tr>
  {/pc}
</table>

</td>

<td id="jsweb8_cn_right2" valign="top"></td>

</tr>

</table>

</div>

<script>
var speed=10

jsweb8_cn_right2.innerHTML=jsweb8_cn_right1.innerHTML;

function Marquee4(){

if(jsweb8_cn_right2.offsetWidth-jsweb8_cn_right.scrollLeft<=0)

jsweb8_cn_right.scrollLeft-=jsweb8_cn_right2.offsetWidth;

else{

jsweb8_cn_right.scrollLeft++;

}

}

var MyMar4=setInterval(Marquee4,speed);

jsweb8_cn_right.onmouseover=function() {clearInterval(MyMar4);}

jsweb8_cn_right.onmouseout=function() {MyMar4=setInterval(Marquee4,speed);}

</script>
        </div>

=====================
右滚动
<div class="box">
<div id="jsweb8_cn_right" style="overflow:hidden;width:740px;">

<table cellpadding="0" cellspacing="0" border="0">

<tr><td id="jsweb8_cn_right1" valign="top" align="center">

<table cellpadding="2" cellspacing="0" border="0">
    {pc:content  action="position" posid="12" thumb="1" order="listorder DESC" num="10"}
<tr align="center">
  {loop $data $r}
<td><div class="img-wrap">
                        <a href="{$r[url]}" title="{$r[title]}"><img src="{thumb($r[thumb],180,160)}" title="{$r[title]}"/></a>
                    </div>
                    <a href="{$r[url]}" title="{$r[title]}">{str_cut($r[title],20)}</a></td>
  {/loop}
</tr>
  {/pc}
</table>

</td>

<td id="jsweb8_cn_right2" valign="top"></td>

</tr>

</table>

</div>

<script>

var speed=10

jsweb8_cn_right2.innerHTML=jsweb8_cn_right1.innerHTML;

function Marquee4(){

if(jsweb8_cn_right.scrollLeft<=0)

jsweb8_cn_right.scrollLeft+=jsweb8_cn_right2.offsetWidth;

else{

jsweb8_cn_right.scrollLeft--;

}

}

var MyMar4=setInterval(Marquee4,speed);

jsweb8_cn_right.onmouseover=function() {clearInterval(MyMar4);}

jsweb8_cn_right.onmouseout=function() {MyMar4=setInterval(Marquee4,speed);}

</script>
      </div>

希望对你们有帮助