首页
资源
专题
注册
|
登录
当前位置:
网站首页
> 资源显示
js
向左滚动代码,向左不间断滚动JS代码
发布时间:
2017/5/1 10:27:44 /
浏览:
644
向左滚动代码,向左不间断滚动JS代码
完整代码 (代码框可以往下拉高显示):
<!--下面是向左滚动代码--> <div id="colee_left" style="overflow:hidden;width:960px;"> <table cellpadding="0" cellspacing="0" border="0"> <tr><td id="colee_left1" valign="top" align="center"> <table cellpadding="2" cellspacing="0" border="0"> <tr align="center"> <td><div class="xyrPic"><a href="#" title="test"><img src="images/test_m.jpg" width="115" height="152" border="0" /></a></div></td> <td><div class="xyrPic"><a href="#" title="test"><img src="images/test_m.jpg" width="115" height="152" border="0" /></a></div></td> <td><div class="xyrPic"><a href="#" title="test"><img src="images/test_m.jpg" width="115" height="152" border="0" /></a></div></td> <td><div class="xyrPic"><a href="#" title="test"><img src="images/test_m.jpg" width="115" height="152" border="0" /></a></div></td> <td><div class="xyrPic"><a href="#" title="test"><img src="images/test_m.jpg" width="115" height="152" border="0" /></a></div></td> <td><div class="xyrPic"><a href="#" title="test"><img src="images/test_m.jpg" width="115" height="152" border="0" /></a></div></td> </tr> </table> </td> <td id="colee_left2" valign="top"></td> </tr> </table> </div> <script> //使用div时,请保证colee_left2与colee_left1是在同一行上. var speed=30//速度数值越大速度越慢 var colee_left2=document.getElementById("colee_left2"); var colee_left1=document.getElementById("colee_left1"); var colee_left=document.getElementById("colee_left"); colee_left2.innerHTML=colee_left1.innerHTML function Marquee3(){ if(colee_left2.offsetWidth-colee_left.scrollLeft<=0)//offsetWidth 是对象的可见宽度 colee_left.scrollLeft-=colee_left1.offsetWidth//scrollWidth 是对象的实际内容的宽,不包边线宽度 else{ colee_left.scrollLeft++ } } var MyMar3=setInterval(Marquee3,speed) colee_left.onmouseover=function() {clearInterval(MyMar3)} colee_left.onmouseout=function() {MyMar3=setInterval(Marquee3,speed)} </script> <!--向左滚动代码结束--> ---------------- 同一个页面多个滚动,笨办法,当然也可以改造函数 ------------------ 可以批量将“_2”替换为“_n” <!--下面是向左滚动代码--> <div id="colee_left_2" style="overflow:hidden;width:960px;"> <table cellpadding="0" cellspacing="0" border="0"> <tr><td id="colee_left1_2" valign="top" align="center"> <table cellpadding="2_2" cellspacing="0" border="0"> <tr align="center"> <td><div class="xyrPic"><a href="#" title="test"><img src="images/test_m.jpg" width="115" height="152" border="0" /></a></div></td> <td><div class="xyrPic"><a href="#" title="test"><img src="images/test_m.jpg" width="115" height="152" border="0" /></a></div></td> <td><div class="xyrPic"><a href="#" title="test"><img src="images/test_m.jpg" width="115" height="152" border="0" /></a></div></td> <td><div class="xyrPic"><a href="#" title="test"><img src="images/test_m.jpg" width="115" height="152" border="0" /></a></div></td> <td><div class="xyrPic"><a href="#" title="test"><img src="images/test_m.jpg" width="115" height="152" border="0" /></a></div></td> <td><div class="xyrPic"><a href="#" title="test"><img src="images/test_m.jpg" width="115" height="152" border="0" /></a></div></td> </tr> </table> </td> <td id="colee_left2_2" valign="top"></td> </tr> </table> </div> <script> //使用div时,请保证colee_left2与colee_left1是在同一行上. var speed_2=30//速度数值越大速度越慢 var colee_left2_2=document.getElementById("colee_left2_2"); var colee_left1_2=document.getElementById("colee_left1_2"); var colee_left_2=document.getElementById("colee_left_2"); colee_left2_2.innerHTML=colee_left1_2.innerHTML function Marquee3_2(){ if(colee_left2_2.offsetWidth-colee_left_2.scrollLeft<=0)//offsetWidth 是对象的可见宽度 colee_left_2.scrollLeft-=colee_left1_2.offsetWidth//scrollWidth 是对象的实际内容的宽,不包边线宽度 else{ colee_left_2.scrollLeft++ } } var MyMar3_2=setInterval(Marquee3_2,speed_2) colee_left_2.onmouseover=function() {clearInterval(MyMar3_2)} colee_left_2.onmouseout=function() {MyMar3_2=setInterval(Marquee3_2,speed_2)} </script> <!--向左滚动代码结束-->
附件资源(免费)
您尚未登录,暂时无法查阅资源!
立即登录
插播广告区
发表评论
您尚未登录,暂时无法发表评论。
立即登录
暂无任何评论
推荐专题
更多专题
框架-插件集
ASP独立功能案例
ASP上传组件范例
编辑器插件详解
在线支付接口开发
常用广告轮换组件
常用在线客服组件
网页布局效果范例
ASP函数库汇总
ASP知识点详解
推荐资源
更多 >>
1
asp连接sqlite数据库代码!
2
ASP违禁词批处理V1.0_acces
3
关于height100和height1
4
aspJpeg_ASPS水印组件(安装
5
正文多图预览组件2(Viewer.js
6
正文多图预览组件(fancybox)
7
UNION多表联合查询,多表联合搜索问
8
jq隐藏table中的tr或td,防止
9
SQLServer2008数据库复制,
10
CSS解决长串英文字母显示不能自动换行
付费资源
更多 >>
1
ASP违禁词批处理V1.0_acces
2
A标签实现多选框赋值(限定选择个数)
3
云片网(短信验证码接入案例-ASP版本
4
模块选择(N个模块多选,每个模块可以选
5
多参数检索URL的参数处理(多条件查询
6
kindeditor_编辑器实战经验总
7
选择不同产品自动切换价格,价格切换JS
8
会员图像上传组件,flash上传头像剪
9
会员注册-登录-改密功能_gb2312
10
程序伪静态,URL静态化处理
广告区
CopyRight © 2017 www.kaifaku.cn All Rights Reserved - 版权所有 © 开发库 (所有资源来源于实战项目,拿来即用)
付费资源请联系 QQ:2633993818 / E-MAIL:2633993818@qq.com 本站免费分享资源不提供免费咨询