我自己也在用的,网页常用!分享出来

  最简单易懂源码

<!--下面是向上滚动代码-->

<div id=butong_net_top style=overflow:hidden;height:;width:;>
<div id=butong_net_top1>
<img src="插入需要滚动的图片">
<img src="插入需要滚动的图片">
<img src="插入需要滚动的图片">
<img src="插入需要滚动的图片">
<img src="插入需要滚动的图片">
</div>
<div id=butong_net_top2></div>
</div>
<script>
var speed=
butong_net_top2.innerHTML=butong_net_top1.innerHTML //克隆butong_net_top1为butong_net_top2
function Marquee1(){
//当滚动至butong_net_top1与butong_net_top2交界时
if(butong_net_top2.offsetTop-butong_net_top.scrollTop<=)&<;&<;
butong_net_top.scrollTop-=butong_net_top1.offsetHeight //butong_net_top跳到最顶端
else{
butong_net_top.scrollTop++;
}
}
var MyMar1=setInterval(Marquee1,speed)//设置定时器
//鼠标移上时清除定时器达到滚动停止的目的
butong_net_top.οnmοuseοver=function() {clearInterval(MyMar1)}
//鼠标移开时重设定时器
butong_net_top.οnmοuseοut=function(){MyMar1=setInterval(Marquee1,speed)}
</script> <!--向上滚动代码结束--> <br> <!--下面是向下滚动代码--> <div id=butong_net_bottom style=overflow:hidden;height:;width:;>
<div id=butong_net_bottom1>
<img src="插入需要滚动的图片">
<img src="插入需要滚动的图片">
<img src="插入需要滚动的图片">
<img src="插入需要滚动的图片">
<img src="插入需要滚动的图片">
</div>
<div id=butong_net_bottom2></div>
</div>
<script>
var speed=
butong_net_bottom2.innerHTML=butong_net_bottom1.innerHTML
butong_net_bottom.scrollTop=butong_net_bottom.scrollHeight
function Marquee2(){
if(butong_net_bottom1.offsetTop-butong_net_bottom.scrollTop>=)
butong_net_bottom.scrollTop+=butong_net_bottom2.offsetHeight
else{
butong_net_bottom.scrollTop--
}
}
var MyMar2=setInterval(Marquee2,speed)
butong_net_bottom.οnmοuseοver=function() {clearInterval(MyMar2)}
butong_net_bottom.οnmοuseοut=function() {MyMar2=setInterval(Marquee2,speed)}
</script> <!--向下滚动代码结束--> <br> <!--下面是向左滚动代码--> <div id="butong_net_left" style="overflow:hidden;width:500px;">
<table cellpadding="" cellspacing="" border="">
<tr><td id="butong_net_left1" valign="top" align="center">
<table cellpadding="" cellspacing="" border="">
<tr align="center">
<td><img src="<img src="插入需要滚动的图片"></td>
<td><img src="插入需要滚动的图片"></td>
<td><img src="插入需要滚动的图片"></td>
<td><img src="插入需要滚动的图片"></td>
<td><img src="插入需要滚动的图片"></td>
</tr>
</table>
</td>
<td id="butong_net_left2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=//速度数值越大速度越慢
butong_net_left2.innerHTML=butong_net_left1.innerHTML
function Marquee3(){
if(butong_net_left2.offsetWidth-butong_net_left.scrollLeft<=)
butong_net_left.scrollLeft-=butong_net_left1.offsetWidth
else{
butong_net_left.scrollLeft++
}
}
var MyMar3=setInterval(Marquee3,speed)
butong_net_left.οnmοuseοver=function() {clearInterval(MyMar3)}
butong_net_left.οnmοuseοut=function() {MyMar3=setInterval(Marquee3,speed)}
</script> <!--向左滚动代码结束--> <br> <!--下面是向右滚动代码--> <div id="butong_net_right" style="overflow:hidden;width:500px;">
<table cellpadding="" cellspacing="" border="">
<tr><td id="butong_net_right1" valign="top" align="center">
<table cellpadding="" cellspacing="" border="">
<tr align="center">
<td><img src="插入需要滚动的图片"></td>
<td><img src="插入需要滚动的图片"></td>
<td><img src="插入需要滚动的图片"></td>
<td><img src="插入需要滚动的图片"></td>
<td><img src="插入需要滚动的图片"></td>
</tr>
</table>
</td>
<td id="butong_net_right2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=//速度数值越大速度越慢
butong_net_right2.innerHTML=butong_net_right1.innerHTML
function Marquee4(){
if(butong_net_right.scrollLeft<=)
butong_net_right.scrollLeft+=butong_net_right2.offsetWidth
else{
butong_net_right.scrollLeft--
}
}
var MyMar4=setInterval(Marquee4,speed)
butong_net_right.οnmοuseοver=function() {clearInterval(MyMar4)}
butong_net_right.οnmοuseοut=function() {MyMar4=setInterval(Marquee4,speed)}
</script> <!--向右滚动代码结束-->

做项目的时候我就是拿这个来用,分享给大家源码出自:https://blog.csdn.net/sikong00/article/details/78628984

html 图片滚动代码的更多相关文章

  1. HTML网页图片滚动代码

    <!--下面是向上滚动代码--> <div id=butong_net_top style=overflow:hidden;height:100;width:90;> < ...

  2. JS图片滚动代码(无缝、平滑)

    非常平滑的JS图片滚动特效代码,无缝循环,速度可自定义,鼠标悬停时停止.它的特点是JS和图片地址分离,这样做你就经易的从数据库动态调用每张图片的地址,方便控制,因此它非常的应用. <!DOCTY ...

  3. jquery图片无缝滚动代码左右 上下无缝滚动图片

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. 原生js实现tab选项卡里内嵌图片滚动特效代码

    <!DOCTYPE HTML><html lang="en-US"><head><meta charset="UTF-8&quo ...

  5. 常用JS图片滚动(无缝、平滑、上下左右滚动)代码大全

    innerHTML:    设置或获取位于对象起始和结束标签内的 HTML scrollHeight: 获取对象的滚动高度. scrollLeft:   设置或获取位于对象左边界和窗口中目前可见内容的 ...

  6. 图片滚动(UP)的JS代码详解(offsetTop、scrollTop、offsetHeigh)【转】

    源地址 信息技术教材配套的光盘里有一段设置图片滚动的JS代码,与网络上差不多,实现思路:一个设定高度并且隐藏超出它高度的内容的容器demo,里面放demo1和 demo2,demo1是滚动内容,dem ...

  7. 可以左右移动横向无缝滚动的JS图片展示代码

    在酷站网站下的,具体路径忘了,稍微改了一下,让它看起来像组滑动 1)被引用的js文件ScrollPic.js ?){){i+=l.length;)I=document.cookie.length;o= ...

  8. 图片滚动js代码

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...

  9. 图片左右循环连续滚动代码,解决marquee的留白问题

    <marquee ONMOUSEOUT="this.start()" ONMOUSEOVER="this.stop()" DIRECTION=" ...

随机推荐

  1. [20190505]ts 命令在哪里.txt

    [20190505]ts 命令在哪里.txt --//在论坛问一下ts命令在哪里?没人解答,自己也google看了一下:https://unix.stackexchange.com/questions ...

  2. UML——Use Case Diagram(用例图)

    用例图主要用来描述角色以及角色与用例之间的连接关系.说明的是谁要使用系统,以及他们使用该系统可以做些什么.一个用例图包含了多个模型元素,如系统.参与者和用例,并且显示这些元素之间的各种关系,如泛化.关 ...

  3. 【Java】理解ClassNotFoundException与NoClassDefFoundError的区别

    一.概念上的认识 1)Exception与Error的区别 1.Exception的出现不会导致程序结束,用户程序可以捕获该异常 2.Error的出现会导致程序结束,用户程序无法捕获Error错误 2 ...

  4. idea加载springboot 项目热加载失效

    需要打开 help -> find action ->registry ->其中的compiler.automake.allow.when.app.running勾上

  5. 201871010123-吴丽丽《面向对象程序设计(Java)》第十五周学习总结

    201871010123-吴丽丽<面向对象程序设计(Java)>第十五周学习总结 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ ...

  6. springcloud注解解释

    @SpringBootApplication是springboot启动类,包括三个注解,他们的作用分别是:  @Configuration:表示将该类作用springboot配置文件类  @Enabl ...

  7. 基于 webdriver 的测试代码日常调试方python 篇

    看到论坛有人写了JAVA的测试代码日常设计,就给大家分享一下偶自己平时是如何测试测试代码的.主要基于python语言.基于 webdriver 的日常调试在 python交互模式下非常方便,打开pyt ...

  8. MyBatis 使用 foreach 批量插入

    MyBatis 使用 foreach 批量插入 参考博文 老司机学习MyBatis之动态SQL使用foreach在MySQL中批量插入 使用MyBatis一次性插入多条数据时候可以使用 <for ...

  9. 刘长峰 js基础讲座笔记 课后作业

    1.DataType Assert 数据类型断言 一.typeof : 判断变量的类型 ,返回字符串 typeof a   返回 'undefined' .'boolean' .'string' .' ...

  10. C++ string 字符串函数详解

    运算符重载 + 和 +=:连接字符串 =:字符串赋值 >.>=.< 和 <=:字符串比较(例如a < b, aa < ab) ==.!=:比较字符串 << ...