比i走马灯好一点的做法
2016-06-29 12:51
423 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>向上下左右不间断无缝滚动图片的效果(兼容火狐和IE)</title> </head> <body> <div id="colee" style="overflow:hidden;height:253px;width:410px;"> <div id="colee1"> <p><img src="1.gif"></p> <p><img src="2.gif"></p> <p><img src="3.gif"></p> </div> <div id="colee2"></div> </div> <script> var speed=30; var colee2=document.getElementById("colee2"); var colee1=document.getElementById("colee1"); var colee=document.getElementById("colee"); colee2.innerHTML=colee1.innerHTML; function Marquee1(){ if(colee2.offsetTop-colee.scrollTop<=0){ colee.scrollTop-=colee1.offsetHeight; }else { colee.scrollTop++ } } var MyMar1=setInterval(Marquee1,speed) colee.onmouseover=function() {clearInterval(MyMar1)} colee.onmouseout=function(){MyMar1=setInterval(Marquee1,speed)} </script>
相关文章推荐
- popupWindow和listView那些事之自定义下拉框
- 【51CTO学院三周年】加薪啦!从草根运维到年薪20万
- Linux KDE 设置显示桌面的快捷键 win+d
- java.util.concurrent.ThreadPoolExecutor实现机制简介
- nodejs npm常用命令
- HibernateTemplate实现分页
- Moving Average from Data Stream
- 由RGB到HSV颜色空间的理解
- popupwindow异常:unable to add window — token null is not valid
- 自定义ViewGroup
- Hibernate distinct 查询的多种实现方式
- 深入分析@Transactional的用法
- jquery滚动条滚动的指定位置
- Linux常用命令--uniq
- 安装绿色版mysql5.7.13遇到的问题
- Git HEAD 意思详解 和版本回退
- m2e安装
- Spring Data Redis 让 NoSQL 快如闪电 (1)
- JavaSE 基础 第13节 算术赋值运算符与自增自减运算符
- Python实战1_3:爬取租房信息