余志国网站设计工作室是专业从事义乌网站建设、义乌外贸网站建设、义乌网站制作、义乌网站设计的专业义乌网站建设工作室,是义乌外贸网站建设专家!

JavaScript特效:实现上下文字、图片滚动循环显示,中间有停顿

分类:网页设计 Tags: javascript 评论:1 浏览:14010 最近更新时间:2007/3/1 19:26:44

文字、图片滚动循环显示,中间有停顿代码:
<div id="icefable1" style="width:400;">
<!--内容区域开始,可以设为自己的内容-->
<table width='400' height="200" border='0' cellPadding='5' cellSpacing='0'>
  <tr>
    <td align="center" bgcolor="#F2F2F2">1。内容可以自己定义</td>
  </tr>
  <tr>
    <td align="center" bgcolor="#F9FAED">2。内容可以自己定义</td>
  </tr>
</table>
<!--内容区域结束-->
</div>
<div id="icefable2" style="position:absolute;z-index:1;visibility:hidden"></div>
<script>
marqueesHeight=100;//滚动区域高度设定
stopscroll=false;
icefable1.scrollTop=0;
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=0; currentTop=0; stoptime=0;
function init_srolltext(){
icefable2.innerHTML="";
icefable2.innerHTML+=icefable1.innerHTML;
icefable1.innerHTML=icefable2.innerHTML+icefable2.innerHTML;
setInterval("scrollUp()",20);
}
function scrollUp(){
if(stopscroll==true) return;
currentTop+=1;
if(currentTop==100)//向上滚动高度设定
{
 stoptime+=1;
 currentTop-=1;
 if(stoptime==150)//停顿时间设定
 {
  currentTop=0;
  stoptime=0;
 }
}
else {   
   preTop=icefable1.scrollTop;
   icefable1.scrollTop+=1;
   if(preTop==icefable1.scrollTop){
     icefable1.scrollTop=icefable2.offsetHeight-marqueesHeight;
     icefable1.scrollTop+=1;
   }
}
}
init_srolltext();
</script>

(在需要添加该特效的网页具体位置中粘贴如下代码即可可以根据需要进行修改。)

本文地址:/161/
  • 相关文章
  • 推荐文章
  • 最新文章
发表评论





您的IP:18.97.14.82,来自:
长河
1. 长河 : 经过测试,上边代码好像运行不了呀!!! 楼主有空请看看。。 2015/12/11 22:02:19

留言

 


免费咨询
建站咨询热线
15967985565
QQ: 358758308 Skype: yuzhiguo Facebook: yuzhiguo Email