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获取对象相对于版面或由 ...
随机推荐
- centos 6.5网卡dhcp不能获得网关
环境:vmware +centos6.5 添加两个虚拟网卡.一个自动获取ip(用于上网-桥接) 一个手动(与主机通信用于ssh-NAT). 因为自已手动改了一下ifcfg-eth0里面的HWADDR ...
- web前端知识
4.表格与表单 4.1 动态添加行 <script language=”javascript”> window.onload=function(){ var oTr = document. ...
- sqlalchemy--group_concat的使用
今天,一个app客户端同事需要我服务器端提供一组数据,这组数据要按类分好,把整个结构都展示给他,他直接使用就可以了.数据大概如下面这种: 同事需要的结构大概就是类型1有多少,分别是什么;类型2有多少, ...
- Cocos2d粒子系统二
粒子系统的属性: 粒子的发射速度 重力模式(模式A): 重力 方向 速度 +- 变动 切向加速度 +- 变动 径向加速度 +- 变动 半径模式(模式B): 开始半径 +- 变动 结束半径 +- 变动 ...
- mvc4 整合nhibernate3.0配置
鉴于大家都在解决问题或是学习新东西的时候,并不关注是谁又是谁帮你解决了问题,所有这里为自己做下宣传,我为自己代言. 首先介绍下我的开发环境是vs2010旗舰版,nhibernate采用的是3.0版本. ...
- 编译TWRP-recovery教程及源码地址
TWRP这个是一个老外的开源项目,全称Team-Win-Recovery-Project Source:https://github.com/TeamWin/Team-Win-Recovery-Pro ...
- C# and android and socket
利用TCP协议通过Socket编写的网络聊天工具1-客户端 利用TCP协议通过Socket编写的网络聊天工具2-通用类设计 利用TCP协议通过Socket编写的网络聊天工具3-服务器端设计
- yiic模块module使用
模块是一个独立的软件单元,它包含 模型, 视图, 控制器 和其他支持的组件. 在许多方面上,模块看起来像一个 应用.主要的区别就是模块不能单独部署,它必须存在于一个应用里. 用户可以像他们访问普通应用 ...
- rnqoj-28-合唱队形-最长上升子序列
想当年大一的时候,一个最长上升子序列的问题使得我的罚时上升了不少....当年还是图样啊 这道题目本质就是求最长上升子序列 #include<stdio.h> #include<str ...
- [转载]memcached stats 命令
STAT pid 1552 STAT uptime 3792 STAT time 1262517674 STAT version 1.2.6 STAT pointer_size 32 STAT cur ...