手机店盈利模式:询问一个关于JS图片循环的问题,高手请进。

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/06 04:08:11
想要实现效果:3个BANNER图片从下至上循环滚动,每个图片都稍有停留,(前述效果已经实现),关键稳问题是想在图片循环过程中增加“减速度”效果,也就是下一图片快速滚动出来,越接近边缘越慢,有点象地铁进站的感觉,这段总是没法实现,希望高手帮忙。

效果可以预览:http://www.windiness.com/js/

代码如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
body {
background-color: #000033;
}
-->
</style></head>

<body>
<table width="724" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="984"><div id=icefable1>
<table width="724" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="724" height="166" bgcolor="#0099CC">1</td>
</tr>
<tr>
<td height="166" bgcolor="#00FFCC">2</td>
</tr>
<tr>
<td height="166" bgcolor="#99FF00">3</td>
</tr>
</table>
<script>
marqueesHeight=166;
stopscroll=false;
with(icefable1){
style.width=0;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
preTop=1; currentTop=marqueesHeight; stoptime=1;
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==marqueesHeight+1)
{
stoptime+=1;
currentTop-=1;
if(stoptime==500)
{
currentTop=0;
stoptime=0;
}
}
else {
preTop=icefable1.scrollTop;
icefable1.scrollTop+=1;
if(preTop==icefable1.scrollTop){
icefable1.scrollTop=marqueesHeight;
icefable1.scrollTop+=1;

}
}

}
init_srolltext();
</script>
</div>
</td>
</tr>

</table>
</body>
</html>