无缝滚动及setInterval问题.

shqlsl 2006-10-28 03:40:07
最近写了一个东西.
让DIV 加一个scroll 就可成为无缝滚动.
演示:http://test.quansou.net/gaorui/scroll.html
代码在http://test.quansou.net/gaorui/scroll.js

问题1,如何做到 无缝连接( 我的会有闪动)
问题2,我的所有div 衡向和纵向速度只会取一个. 取他们最小的,我本意是第一个都有自己的速度,可是怎么做都不好成功.

请高手指点. 高分增送
...全文
274 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Eilien 2006-10-28
  • 打赏
  • 举报
回复
mark
jhdl_n 2006-10-28
  • 打赏
  • 举报
回复
<div id="icefable1">

<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">

<tr valign="top"><!-- BEGIN promote_row 0,5 -->
<td width="756"> <table width="140" height="140" border="0" cellpadding="0" cellspacing="0">

<tr>
<td width="21" height="100"> </td>
<td width="100"><a href="{promotelink}" target="_blank"><img src="{promoteimg}" alt="{promoteintro}" width="110" height="110" border="0" /></a></td>
<td width="19"> </td>
</tr>
<tr>
<td colspan="3" valign="top"><div align="center">{promotetitle}</div></td>
</tr>

</table></td>
<!-- END promote_row --></tr>

</table>
</div>
</td>
</tr>
<tr>

</tr>
</table></td>
</tr>

<tr>
<td><img src="images/recommandprotitlebo.gif" width="763" height="10"></td>
</tr>
</table>
</body>
</html>
<script>
marqueesHeight=144;
stopscroll=false; with(icefable1)
{
style.width=700;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
preTop=0; currentTop=144; stoptime=0;
icefable1.innerHTML+=icefable1.innerHTML;
function init_srolltext()
{
icefable1.scrollTop=0;
setInterval("scrollUp()",1);
}
init_srolltext();
function scrollUp()
{
if(stopscroll==true) return;
currentTop+=1;
if(currentTop==145)
{
stoptime+=1;
currentTop-=1;
if(stoptime==300)
{
currentTop=0;
stoptime=0;
}
}
else
{
preTop=icefable1.scrollTop;
icefable1.scrollTop+=1;
if(preTop==icefable1.scrollTop)
{
icefable1.scrollTop=144;
icefable1.scrollTop+=1;
}
}

}
</script>
stou 2006-10-28
  • 打赏
  • 举报
回复
頂樓上
myvicy 2006-10-28
  • 打赏
  • 举报
回复
滚动的高度大于显示区应该好一些。
shqlsl 2006-10-28
  • 打赏
  • 举报
回复
对不起 地址给错了
正确的地址是这个:
http://www.quansou.com/scroll/scroll.html
http://www.quansou.com/scroll/scroll.js
Unending 2006-10-28
  • 打赏
  • 举报
回复
已经很不错了,收藏

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧