本文实例为大家分享了无缝滚动效果Java脚本语言代码实现,供大家参考,具体内容如下】
效果图:
实现代码:
!DOCTYPE html html head meta charset=' GB 2312 '/title zzz/title style * { margin : 0;划水:0;}车身{ width : 1000 pxmargin : 100px自动;背景-color : # fff;} #包装器{ overflow:隐藏;宽度: 600像素;高度: 100像素;相对位置:} # wrapper ul { position : absolute;左: 0;top : 0;} #包装li{左侧浮动:列表样式:无;} #包装li img {宽度: 150像素高度: 100像素;边界半径: 9px}输入[type=button]{ margin-top : 20px;宽度: 35px高度: 25px线高: 25px}/样式脚本类型=' text/JavaScript '窗口。onload=function(){ var timer=null;变速=4;var od=document.getElementById('包装');var au=od。getelementsbytagname(' ul ')[0];var Ali=au。getelementsbytagname(' Li ');au。innerHTMl=au。innerHTMl au。innerHTMlau.style.width=ali[0].offsettwidth * Ali . length ' pxtimer=setInterval(move,30)函数move(){ if(au。场外交易。offset DTH/2){ au。风格。left=' 0} if(au。offsetleft 0){ au。风格。左=-au。offsetweidth/2 ' px ';} au。风格。左=au。偏移速度' px;} od。onmouseover=function(){ clearInterval(计时器);} od。onmouseout=function(){ timer=setInterval(move,30)}文档。getelementbyid(' BTN 1 ').onclick=function(){ speed=-4;} document.getElementById('btn2 ').onclick=function(){ speed=4;} }/script/head body div id=' wrapper ' ul liimg src=' http : img/pic4。jpg '/Li Li img src=' http : img/pic3。jpg '/Li Li img src=' http : img/pic2。jpg '/李丽丽img src=' http : img/pic1。jpg '/Li/ul/div输入类型=' button '名称id='向左/input type=' button ' id=' BTN 2 ' value='向右//正文/html大家可以参考以下专题进行学习:
《JavaScript滚动效果汇总》 《jQuery滚动效果汇总》 《JavaScript图片轮播效果汇总》
以上就是本文的全部内容,希望对大家学习Java脚本语言程序设计有所帮助。