js图片无缝滚动,中间滚动的距离过大,怎么调整 ?
<DIVid=demoleftstyle="OVERFLOW:hidden;WIDTH:746px;height:189px"><TABLEborder="0"align...
<DIV id=demoleft style="OVERFLOW: hidden; WIDTH:746px;height:189px">
<TABLE border="0" align="center" cellPadding="0" cellSpacing="0" cellspace="0">
<TBODY>
<TR>
<TD width="745" align=middle vAlign=top id=demo1left>
<!--内容-->
<table width="745" height="120" border="0" cellpadding="0" cellspacing="0">
<tr>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 * from cp_aboutus where userid="&hid&" order by updatetime desc,articleid desc ",conn,1,1
if not rs.eof then
dim hang
hang = 0
do while not rs.eof
hang = hang + 1
%>
<td>
<table width="120" height="120" border="0" align="center" cellpadding="0" cellspacing="0" id="table12">
<tr>
<td width="120" height="120"><a>{$Mr_图说}</a><%else response.Write "<table width=120 height=120 border=0 cellpadding=0 cellspacing=0><tr><td height=23 bgcolor=#EBEBEB align=center>{$Mr_图说}</td></tr></table>" end if%></td>
</tr>
<tr>
<td align="center"></td>
</tr>
</table>
</td>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
</tr>
</table>
<!--end 内容-->
</TD>
<TD width="0" vAlign=top id=demo2left></TD>
</TR>
</TBODY>
</TABLE>
</DIV>
<SCRIPT>
var speed=18//速度数值越大速度越慢,demo2.offsetWidth=demo1.offsetWidth=固定值
var demoleft = document.getElementById("demoleft");
var demo2left = document.getElementById("demo2left");
var demo1left = document.getElementById("demo1left");
demo2left.innerHTML=demo1left.innerHTML
function Marquee(){
if(demo2left.offsetWidth-demoleft.scrollLeft<=0)//其实demo.scrollLeft是有 最大值的,和demo0.width,引用的图片的width有关系。demo过了一半(每半内容一样的),重新开始循环
demoleft.scrollLeft-=demo1left.offsetWidth
else{
demoleft.scrollLeft++//不断的增加,相当于父容器的滚动条不断是缩小;但由于OVERFLOW: hidden; (滚动条不可见)
}
}
var MyMarleft=setInterval(Marquee,speed)
demoleft.onmouseover=function() {clearInterval(MyMarleft)}
demoleft.onmouseout=function() {MyMarleft=setInterval(Marquee,speed)}
</SCRIPT>
距离过大指最后一张和第一张图片之间的距离。想调整为第2张和第3张之间的那个距离。 展开
<TABLE border="0" align="center" cellPadding="0" cellSpacing="0" cellspace="0">
<TBODY>
<TR>
<TD width="745" align=middle vAlign=top id=demo1left>
<!--内容-->
<table width="745" height="120" border="0" cellpadding="0" cellspacing="0">
<tr>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 * from cp_aboutus where userid="&hid&" order by updatetime desc,articleid desc ",conn,1,1
if not rs.eof then
dim hang
hang = 0
do while not rs.eof
hang = hang + 1
%>
<td>
<table width="120" height="120" border="0" align="center" cellpadding="0" cellspacing="0" id="table12">
<tr>
<td width="120" height="120"><a>{$Mr_图说}</a><%else response.Write "<table width=120 height=120 border=0 cellpadding=0 cellspacing=0><tr><td height=23 bgcolor=#EBEBEB align=center>{$Mr_图说}</td></tr></table>" end if%></td>
</tr>
<tr>
<td align="center"></td>
</tr>
</table>
</td>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
</tr>
</table>
<!--end 内容-->
</TD>
<TD width="0" vAlign=top id=demo2left></TD>
</TR>
</TBODY>
</TABLE>
</DIV>
<SCRIPT>
var speed=18//速度数值越大速度越慢,demo2.offsetWidth=demo1.offsetWidth=固定值
var demoleft = document.getElementById("demoleft");
var demo2left = document.getElementById("demo2left");
var demo1left = document.getElementById("demo1left");
demo2left.innerHTML=demo1left.innerHTML
function Marquee(){
if(demo2left.offsetWidth-demoleft.scrollLeft<=0)//其实demo.scrollLeft是有 最大值的,和demo0.width,引用的图片的width有关系。demo过了一半(每半内容一样的),重新开始循环
demoleft.scrollLeft-=demo1left.offsetWidth
else{
demoleft.scrollLeft++//不断的增加,相当于父容器的滚动条不断是缩小;但由于OVERFLOW: hidden; (滚动条不可见)
}
}
var MyMarleft=setInterval(Marquee,speed)
demoleft.onmouseover=function() {clearInterval(MyMarleft)}
demoleft.onmouseout=function() {MyMarleft=setInterval(Marquee,speed)}
</SCRIPT>
距离过大指最后一张和第一张图片之间的距离。想调整为第2张和第3张之间的那个距离。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询