不间断图片横向滚动特效代码
2016-12-20 15:02
363 查看
<html> <head> <style> body{margin:0px;} ul{list-style:none; border:0; padding:0px; margin:0px;} li{list-style:none; float:left; border:0; padding:0px; margin:0px;} img{border:0px; padding:0px; margin:0px;} </style> </head> <body> <center><div id="div1" style="overflow:hidden; cursor:hand; margin-top:50px;" onmouseover="stop()" onmouseout="ss()"> <ul id="img" style="clear:both;"><!--放图片的容器,此容器在div1里滚动--> <!--以下是要滚动的内容--> <li><img id="img0" src="http://www.alixixi.com/images/index180.gif" width="100" height="100" style="display:block;" /></li> <li><img id="img1" src="http://www.alixixi.com/images/index180.gif" width="100" height="100" style="display:block;" /></li> <li><img id="img2" src="http://www.alixixi.com/images/index180.gif" width="100" height="100" style="display:block;" /></li> <li><img id="img3" src="http://www.alixixi.com/images/index180.gif" width="100" height="100" style="display:block;" /></li> </ul> </div> </center> <script language="javascript"> var w,h,id,speed,Html w=400;//-------滚动容器的宽度--------// h=100;//-------滚动容器的高度--------// id="div1";//-------滚动容器的id--------// direction="left";//-------滚动方向有四个值left,right,up,down,自己试试--------// speed="100";//-------滚动速度100相当于1秒,越小越快--------// imgDiv="img";//-------放图片的容器id--------// HtmlL=document.getElementById(imgDiv).innerHTML; HtmlT=document.getElementById(id).innerHTML; switch (direction) { case "left": document.getElementById(imgDiv).innerHTML=HtmlL+HtmlL; break; case "right": document.getElementById(imgDiv).innerHTML=HtmlL+HtmlL; break; case "up": document.getElementById(id).innerHTML=HtmlT+HtmlT; break; case "down": document.getElementById(id).innerHTML=HtmlT+HtmlT; break; } function ss(){ document.getElementById(id).style.width=w; document.getElementById(id).style.height=h; document.getElementById(imgDiv).style.width=w*2; document.getElementById(imgDiv).style.height=h; var ele ele=document.getElementById("div1"); switch (direction) { case "left": ele.scrollLeft=ele.scrollLeft+5; if (ele.scrollLeft>=w) { ele.scrollLeft=0; } break; case "right": ele.scrollLeft=ele.scrollLeft-5; if (ele.scrollLeft<=0) { ele.scrollLeft=w; } break; case "up": ele.scrollTop=ele.scrollTop+5; if (ele.scrollTop>=h) { ele.scrollTop=0; } break; case "down": ele.scrollTop=ele.scrollTop-5; if (ele.scrollTop<=0) { ele.scrollTop=h; } break; } t=setTimeout("ss()",speed); } function stop(){ document.getElementById("div1").scrollLeft=document.getElementById("div1").scrollLeft; document.getElementById("div1").scrollTop=document.getElementById("div1").scrollTop; clearTimeout(t); } setTimeout("ss()",100); </script> </body> </html>
<a href="http://js.alixixi.com/">欢迎访问阿里西西网页特效代码站,js.alixixi.com</a>
相关文章推荐
- 不间断图片横向滚动特效代码
- 图片不间断滚动的特效代码详细讲解
- JS特效之连续不断横向滚动图片代码
- 连续不间断横向滚动图片代码
- 连续不间断横向滚动图片代码
- JS特效代码大全(六)图片横向滚动效果
- 连续不间断横向滚动图片代码
- JS特效代码大全(六)图片横向滚动效果
- --连续不间断横向滚动图片代码--
- 图片横向不间断滚动代码(div+css)
- 不间断滚动图片代码
- 连续不间断横向滚动图片
- 不间断图片滚动代码
- JS图片不间断滚动代码(向上,向下,向左,向右)
- 上下左右无空隙不间断图片连续滚动代码
- 由于自己的需要搜集的一些关于 “ javascript实现图片的不间断连续滚动” 的代码
- 不间断图片左右滚动代码
- JavaScript特效:横向不间断滚动
- 文字不间断向左滚动的网页特效代码
- JS滚动图片代码(含横向和纵向)