[js脚本实现]图片向上滚动并且有停顿的特效

<!-- 把下列代码放到<body>中-->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td>
              <table width="500" border="0" cellspacing="0" align="center">
      <tr><td>
        <div ></div>
        </td></tr>
</table>

<script>
articleHeight=80; //设置为图片高度
stopscrolla=false;
article1.scrollTop=0;
with(article1){
  style.width=0;
  style.height=articleHeight;
  style.overflowX="visible";
  style.overflowY="hidden";
  noWrap=true;
  onmouseover=new Function("stopscrolla=true");
  onmouseout=new Function("stopscrolla=false");
}

preTopa=0; currentTopa=0; stoptimea=0;

function init_srolltext1(){
  article2.innerHTML="";
  article2.innerHTML+=article1.innerHTML;   
  article1.innerHTML=article2.innerHTML+article2.innerHTML;
  setInterval("scrollUp1()",1); //图片滚动速度
}
function scrollUp1(){
  if(stopscrolla==true) return;
  currentTopa+=1;
  if(currentTopa==81)//设置为图片高度稍大一些,防止出现多次滚动后留边
  {
   stoptimea+=1;
   currentTopa-=1;
   if(stoptimea==200) //暂停时间
   {
    currentTopa=0;
    stoptimea=0;
   }
  }
  else {  
   preTopa=article1.scrollTop;
   article1.scrollTop+=1;
   if(preTopa==article1.scrollTop){
     article1.scrollTop=article2.offsetHeight-articleHeight;
     article1.scrollTop+=1;
   }
  }

}
init_srolltext1();
</script>

相关文章:

  • 2022-12-23
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案