js带箭头左右翻动控制
<!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>带左右箭头切换的自动滚动图片JS特效</title>
<style type="text/css">
*{margin:0px; padding:0px;}
img{border:0;}
a{text-decoration:none;}
a:hover{text-decoration:underline;}
li{list-style:none; list-style-image:none; list-style-type:none;}
.rollBox{width:938px;overflow:hidden;padding:0;margin:0 auto; background-color:#F8F8F8;}
.rollBox .LeftBotton{height:29px;width:19px;background:url(http://www.huizhou.cn/webfile/2012/8/21/images/left.jpg) no-repeat;overflow:hidden;float:left;display:inline;margin:44px 0 0 0;cursor:pointer;}
.rollBox .RightBotton{height:29px;width:19px;background:url(http://www.huizhou.cn/webfile/2012/8/21/images/right.jpg) no-repeat right 0;overflow:hidden;float:left;display:inline;margin:44px 0 0 0;cursor:pointer;}
.rollBox .Cont{width:900px;overflow:hidden;float:left;}
.rollBox .ScrCont{width:10000000px;}
.rollBox .Cont .pic{width:172px;float:left;text-align:center; margin-right:10px;}
.rollBox .Cont .pic img{display:block; margin-bottom:7px;}
.rollBox .Cont .pic p,.rollBox .Cont .pic p a{font:normal 12px/20px "宋体";color:#777;}
.rollBox #List1,.rollBox #List2{float:left;}
.rollBox .Cont .pic p span,.rollBox .Cont .pic p span a{color:#E30074;}
</style>
</head> <body> <div class="rollBox"> <div class="LeftBotton" onmousedown="ISL_GoUp()" onmouseup="ISL_StopUp()" onmouseout="ISL_StopUp()"></div> <div class="Cont" id="ISL_Cont"> <div class="ScrCont"> <div id="List1"> <!-- 图片列表 begin --> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_12.htm" target="_blank"><img src="./201208/W020120821628900935063.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_12.htm" target="_blank" target='_blank'>《粽香四溢》</a></span></p>
<p>惠城区 刘心瑜 刘千里</p>
</div> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_11.htm" target="_blank"><img src="./201208/W020120821628548909706.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_11.htm" target="_blank" target='_blank'>《正月十五元宵快乐》</a></span></p>
<p>龙门县 龙城三小 张静瑜</p>
</div> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_10.htm" target="_blank"><img src="./201208/W020120821628231710339.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_10.htm" target="_blank" target='_blank'>《五月端午节》</a></span></p>
<p>惠城区南雁 林晓红</p>
</div> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_9.htm" target="_blank"><img src="./201208/W020120821627724689770.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_9.htm" target="_blank" target='_blank'>《清明节》</a></span></p>
<p>龙门县 方欣仪</p>
</div> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_8.htm" target="_blank"><img src="./201208/W020120821627398439764.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_8.htm" target="_blank" target='_blank'>《七夕》</a></span></p>
<p>龙门县 钟晴</p>
</div> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_7.htm" target="_blank"><img src="./201208/W020120821627020930286.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_7.htm" target="_blank" target='_blank'>《可爱的祖国 》</a></span></p>
<p>仲恺区 罗灵芳</p>
</div> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_6.htm" target="_blank"><img src="./201208/W020120821626694680140.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_6.htm" target="_blank" target='_blank'>《欢度元宵》</a></span></p>
<p>惠阳区秋长 陈茵茵</p>
</div> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_5.htm" target="_blank"><img src="./201208/W020120821626312815924.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_5.htm" target="_blank" target='_blank'>《父爱如山》</a></span></p>
<p>惠城区 陈春雪</p>
</div> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_4.htm" target="_blank"><img src="./201208/W020120821625913286107.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_4.htm" target="_blank" target='_blank'>《端午节快乐》</a></span></p>
<p>惠东县 刘玉洁</p>
</div> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_2.htm" target="_blank"><img src="./201208/W020120821625539531902.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_2.htm" target="_blank" target='_blank'>《端午节》</a></span></p>
<p>惠城区河南岸中心小学 冯沁怡</p>
</div> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_1.htm" target="_blank"><img src="./201208/W020120821624886719505.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_1.htm" target="_blank" target='_blank'>《端午节》</a></span></p>
<p>惠城区 丁南洋</p>
</div> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_3.htm" target="_blank"><img src="./201208/W020120821624443904557.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485_3.htm" target="_blank" target='_blank'>《端午节》</a></span></p>
<p>惠阳区良井 陈泳宏</p>
</div> <div class="pic">
<a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485.htm" target="_blank"><img src="./201208/W020120821624147819546.jpg" width=172 height=124/></a>
<p><span><a href="http://www.huizhou.cn/zt2012/jrxb/zpj/201208/t20120821_754485.htm" target="_blank" target='_blank'>《春之歌》</a></span></p>
<p>博罗县 曾瑞芳</p>
</div> <!-- 图片列表 end --> </div> <div id="List2"></div> </div> </div> <div class="RightBotton" onmousedown="ISL_GoDown()" onmouseup="ISL_StopDown()" onmouseout="ISL_StopDown()"></div> </div> </div> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- //图片滚动列表 5icool.org var Speed = 0; //速度(毫秒) var Space = 5; //每次移动(px) var PageWidth = 182; //翻页宽度 var fill = 0; //整体移位 var MoveLock = false; var MoveTimeObj; var Comp = 0; var AutoPlayObj = null; GetObj("List2").innerHTML = GetObj("List1").innerHTML; GetObj('ISL_Cont').scrollLeft = fill; GetObj("ISL_Cont").onmouseover = function(){clearInterval(AutoPlayObj);} GetObj("ISL_Cont").onmouseout = function(){AutoPlay();} AutoPlay(); function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}} function AutoPlay(){ //自动滚动 clearInterval(AutoPlayObj); AutoPlayObj = setInterval('ISL_GoDown();ISL_StopDown();',10000000000); //间隔时间 } function ISL_GoUp(){ //上翻开始 if(MoveLock) return; clearInterval(AutoPlayObj); MoveLock = true; MoveTimeObj = setInterval('ISL_ScrUp();',Speed); } function ISL_StopUp(){ //上翻停止 clearInterval(MoveTimeObj); if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0){ Comp = fill - (GetObj('ISL_Cont').scrollLeft % PageWidth); CompScr(); }else{ MoveLock = false; } AutoPlay(); } function ISL_ScrUp(){ //上翻动作 if(GetObj('ISL_Cont').scrollLeft <= 0){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft + GetObj('List1').offsetWidth} GetObj('ISL_Cont').scrollLeft -= Space ; } function ISL_GoDown(){ //下翻 clearInterval(MoveTimeObj); if(MoveLock) return; clearInterval(AutoPlayObj); MoveLock = true; ISL_ScrDown(); MoveTimeObj = setInterval('ISL_ScrDown()',Speed); } function ISL_StopDown(){ //下翻停止 clearInterval(MoveTimeObj); if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0 ){ Comp = PageWidth - GetObj('ISL_Cont').scrollLeft % PageWidth + fill; CompScr(); }else{ MoveLock = false; } AutoPlay(); } function ISL_ScrDown(){ //下翻动作 if(GetObj('ISL_Cont').scrollLeft >= GetObj('List1').scrollWidth){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft - GetObj('List1').scrollWidth;} GetObj('ISL_Cont').scrollLeft += Space ; } function CompScr(){ var num; if(Comp == 0){MoveLock = false;return;} if(Comp < 0){ //上翻 if(Comp < -Space){ Comp += Space; num = Space; }else{ num = -Comp; Comp = 0; } GetObj('ISL_Cont').scrollLeft -= num; setTimeout('CompScr()',Speed); }else{ //下翻 if(Comp > Space){ Comp -= Space; num = Space; }else{ num = Comp; Comp = 0; } GetObj('ISL_Cont').scrollLeft += num; setTimeout('CompScr()',Speed); } } //--><!]]> </script>
</body> </html>
js带箭头左右翻动控制的更多相关文章
- Asp.Net实现JS前台带箭头的流程图方法总结!(个人笔记,信息不全)
Asp.Net实现JS前台带箭头的流程图方法总结!(持续更新中) 一.返回前台json格式 json5 = "[{\"Id\":2259,\"Name\&quo ...
- 使用纯CSS实现带箭头的提示框
爱编程爱分享,原创文章,转载请注明出处,谢谢!http://www.cnblogs.com/fozero/p/6187323.html 1.全部代码 <!DOCTYPE html> < ...
- 初探JavaScript(三)——JS带我"碰壁"带我飞
已经写了两篇关于小白的JavaScript之行,不可否认,每一种语言都有其精华与糟粕之处,来不及细细体味其精华奥妙,也没法对其评头论足,只能先了解,后深入.到目前为止已经看完<JavaScrip ...
- css实现带箭头选项卡
这阵子在做一个web端项目中遇到一个问题,需要实现带箭头的选项卡点击可切换.起初没想太多,直接切一个向上的小箭头图片,外层div设置相同颜色的边框,再用相对定位和绝对定位.这种方法是可行的,但是因为手 ...
- AE常用代码(标注要素、AE中画带箭头的线、如何获得投影坐标、参考坐标、投影方式、FeatureCount注意事项)
手上的电脑已经用了将近三年了,想入手一台Surface Pro,所以计划着把电脑上的资料整理下,部分资料打算发到博客上来,资料有同事.也有自己的.也有来自网络的,来源途径太多,也没法详细注明,请见谅! ...
- 不得不吐槽的Android PopupWindow的几个痛点(实现带箭头的上下文菜单遇到的坑)
说到PopupWindow,我个人感觉是又爱又恨,没有深入使用之前总觉得这个东西应该很简单,很好用,但是真正使用PopupWindow实现一些效果的时候总会遇到一些问题,但是即便是人家的api有问题, ...
- popover带箭头弹框
我们先来看一下效果吧: 分析:这个带箭头的弹框其实是一个控制器,通过Modal方式展现,但跟传统模态方式效果不一样,我们一眼就能看出. Xib方式实现popover: 1.segue的时候选择Pres ...
- JS焦点图 上下翻动 支持IE6
<div class="slider"> <ul class="num" id="homePushName"> &l ...
- js鼠标及对象坐标控制属性详细解析
对js鼠标及对象坐标控制属性进行了详细的分析介绍. offsetTop获取对象相对于版面或由 offsetParent 属性指定的父坐标的计算顶端位置. offsetLeft获取对象相对于版面或由 ...
随机推荐
- SelectObject
CPen* SelectObject( CPen* pPen ); CBrush* SelectObject( CBrush* pBrush ); virtual CFont* SelectObjec ...
- XAMPP安装教程
XAMPP(Apache+MySQL+PHP+PERL)是一个功能强大的建站集成软件包.这个软件包原来的名字是LAMPP,但是为了避免误解,最新的几个版本就改名为 XAMPP 了.它可以在Window ...
- cocos2d(粒子效果编辑器)
ParticleDesigner for Mac下载地址:http://www.cocoachina.com/bbs/read.php?tid=108339 最近在做一款粒子编辑器 其实就是在co ...
- 【问题】pod setup 问题
安装pod setup 的时候,可能会安装失败,可以多试几次,但是如果一直失败,那就是由问题了. 解决办法: 1. 分别执行下面命令卸载cocoapods和xcodeproj,如果你的机器上面有多个版 ...
- Linux命令记录
端口号 1.查看端口号 使用netstat -anp来查看那些端口被打开.加参数'-n'会将应用程序转为端口显示,即数字格式的地址,如:nfs->2049, ftp->21,因此可以开启两 ...
- Android之GPS应用开发
LocationManager--------------->Context.LOCATION_SERVICE LocationProvider--------------->Locati ...
- Gridview中的数据导出到excel中
protected void btnExport_Click(object sender, EventArgs e) { //导出全部数据,取消分页 ...
- 最全的TV视频应用合集,包含50多款客户端,有丰富直播点播
这是我目前找到的 最好的视频应用合集,与坛友分享下.有50多款视频客户端,基本覆盖目前市面上口碑比较好的视频应用了. 里面有丰富的直播客户端,像 龙龙直播.泰捷直播.果子 Tv.More Tv等,还有 ...
- Linux企业级项目实践之网络爬虫(27)——多路IO复用
与多线程和多进程相比,I/O多路复用的最大优势是系统开销小,系统不需要建立新的进程或者线程,也不必维护这些线程和进程. 主要应用: (1)客户程序需要同时处理交互式的输入和服务器之间的网络连接 (2) ...
- 难得一见的HTML5动画欣赏及源码下载
今天要给大家分享一些很酷的HTML5动画演示,并且提供源代码的下载.大部分HTML5动画都是通过canvas实现,当然也有基于SVG的,尤其是第一个,看起来很简单,但是创意却不错. 1.HTML5梦幻 ...