废话没多说,直接给大家粘上代码,具体代码如下所示:
var
速度= 30;
无功colee2 = document.getelementbyid(colee2 );
无功colee1 = document.getelementbyid(colee1 );
VaR Colee = document.getelementbyid(Colee );
对colee1 colee2 colee2克隆.innerHTML = colee1.innerhtml; / /
功能marquee1(){
当滚动到colee1 / / colee2结
如果(colee2。offsettop Colee。scrollTop <= 0){
Colee。scrollTop = colee1.offsetheight; / / Colee跳跃到顶端
其他{ }
Colee。scrollTop + +
}
}
无功mymar1 = setInterval(marquee1,速度) / /
设置定时器
/ /当
鼠标移动到停止滚动达到清除定时器
Colee。onmouseover =
函数(){ clearInterval(mymar1)}
/ / onmouseout复位定时器
Colee。onmouseout=函数(){ mymar1 = setInterval(marquee1,速度)}
var速度= 30
无功colee_bottom2 = document.getelementbyid(colee_bottom2 );
无功colee_bottom1 = document.getelementbyid(colee_bottom1 );
无功colee_bottom = document.getelementbyid(colee_bottom );
colee_bottom2 .innerHTML = colee_bottom1.innerhtml
colee_bottom scrollTop = colee_bottom.scrollheight。
功能marquee2(){
如果(colee_bottom1。offsettop-colee_bottom。scrollTop > = 0)
colee_bottom scrollTop + = colee_bottom2.offsetheight。
别的{
colee_bottom.scrolltop-—
}
}
无功mymar2 = setInterval(marquee2,速度)
colee_bottom。onmouseover =函数(){ clearInterval(mymar2)}
colee_bottom。onmouseout=函数(){ mymar2 = setInterval(marquee2,速度)}
DIV / /使用,请确保colee_left2和colee_left1是在同一行。
var速度越高,速度越快,速度越慢,速度越慢,速度越快,速度越快,速度越快,速度越快,速度越快,速度越快,速度越快,速度越快,速度越快,速度越快。
无功colee_left2 = document.getelementbyid(colee_left2 );
无功colee_left1 = document.getelementbyid(colee_left1 );
无功colee_left = document.getelementbyid(colee_left );
colee_left2 .innerHTML = colee_left1.innerhtml
功能marquee3(){
如果(colee_left2。offsetwidth-colee_left。scrollLeft <= 0) / / offsetwidth是对象的可见宽度
colee_left。scrollLeft = colee_left1。offsetwidth / / scrollwidth是对象的实际内容的宽度,没有线的宽度
别的{
colee_left scrollLeft + +。
}
}
无功mymar3 = setInterval(marquee3,速度)
colee_left。onmouseover =函数(){ clearInterval(mymar3)}
colee_left。onmouseout=函数(){ mymar3 = setInterval(marquee3,速度)}
var速度越高,速度越快,速度越慢,速度越慢,速度越快,速度越快,速度越快,速度越快,速度越快,速度越快,速度越快,速度越快,速度越快,速度越快。
无功colee_right2 = document.getelementbyid(colee_right2 );
无功colee_right1 = document.getelementbyid(colee_right1 );
无功colee_right = document.getelementbyid(colee_right );
colee_right2 .innerHTML = colee_right1.innerhtml
功能marquee4(){
如果(colee_right。scrollLeft < = 0)
colee_right scrollLeft + = colee_right2.offsetwidth。
别的{
colee_right.scrollleft-—
}
}
无功mymar4 = setInterval(marquee4,速度)
colee_right。onmouseover =函数(){ clearInterval(mymar4)}
colee_right。onmouseout=函数(){ mymar4 = setInterval(marquee4,速度)}
以上是一系列常用的JS
图片滚动(无缝、平滑,向上或向下),这是由萧边
介绍。我们希望能帮助你。如果你有任何问题,请给我留言,萧边会及时给您回复。谢谢您
支持网站。