产品页图片滚动的参数

2016-07-07 16:26 来源:www.chinab4c.com 作者:ecshop专家



在产品大图下有个滚动的图片代码
我修改了整体表格宽度后浏览时速变快许多,
如我要将宽度调为200
还需要修改以下哪些参数,谢了
<!--滚动图片开始-->
<div id=demo onmouseover=ii=1 style="OVERFLOW: hidden; width:260px; height:54px;" onmouseout=ii=0>
<table cellSpacing=0 cellPadding=0 width=200 border=0>
<tr>
<td>
<div id=demo1>
<table width="260" border="0">
<tr>
<td>
<!-- {foreach from=$pictures item=picture}-->
<a href="gallery.php?id={$id}&img={$picture.img_id}" target="_blank"><img src="{$picture.thumb_url}" alt="{$goods.goods_name}" border="0" width="44" height="54"/></a>
</td>
<!--{/foreach}-->
</td>
</tr>
</table>
</div>
</td>
<td><div id=demo2></div></td>
</tr>
</table>
</div>
<!--滚动图片结束-->
<script>
var ii=0;
var speed=1;
var fangxiang=1;
var demo=document.getElementById('demo');
var demo1=document.getElementById('demo1');
var demo2=document.getElementById('demo2');
demo2.innerHTML=demo1.innerHTML
function andyzsy(){
if (ii==1)return
for(i=1;i<=speed;i++)
{
if(fangxiang=="2")
{
demo.scrollLeft--
if(demo.scrollLeft=="0")
demo.scrollLeft=demo1.offsetWidth
}
else
{
demo.scrollLeft++
if(demo.scrollLeft>=demo1.offsetWidth)
demo.scrollLeft=0
}
}
}
function setspeed(x)
{
speed=x;
}
function setfangxiang(x)
{
fangxiang=x;
}
setInterval(andyzsy,30)
</script>

改setInterval(andyzsy,30)
时间后图片滚动时很不流畅