爱易网
IT新闻
IT新闻
爱易资讯
网站搭建
云虚拟主机教程
云服务器教程
Apache教程
IIS教程
Nginx教程
网站策划
站长文章
推广教程
淘宝客教程
网页设计
HTML教程
XHTML教程
CSS教程
HTML5教程
CSS3教程
JavaSript基础
JQuery教程
Node.js教程
前端技术
Ajax教程
Js特效
Xml教程
平面设计
页面UI设计
photoshop教程
程序开发
AI人工智能
Asp教程
Php教程
Asp.Net教程
Net Core教程
C#教程
Java教程
Jsp教程
开发技术
微信小程序教程
Uniapp开发教程
微信公众号开发
Andriod教程
IOS教程
DOS教程
Python教程
Docker教程
Windows Container教程
数据库
MSSQL教程
MySQL教程
Redis教程
Access教程
Oracle教程
数据库教程
操作系统
Linux教程
Windows教程
MAC教程
Cisco教程
交换机教程
防火墙教程
搜索
爱易网页
JS特效
面向对象的无缝上下滚动图片特效代码,带上下箭头指示
面向对象的无缝上下滚动图片特效代码,带上下箭头指示
日期:2014-05-18 浏览次数:20203 次
以下是程序代码
<!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=utf-8" /> <title>图片无缝滚动——爱易网网页特效,js.aiyiweb.com</title> <style type="text/css"> body,div,ul,li{margin:0;padding:0;} body{background:#052D01;font:12px/1.5 arial;} #box{position:relative;width:210px;height:700px;border:1px solid #5E8743;margin:20px;} #box div{position:absolute;top:50%;left:50%;width:160px;height:570px;overflow:hidden;margin:-285px 0 0 -80px;} #box .up,#box .down{position:absolute;left:50%;width:48px;height:48px;z-index:10;cursor:pointer;overflow:hidden;margin-left:-24px;text-indent:-9999px;background:url(http://js.aiyiweb.com/img/201108/arrow.jpg) no-repeat;} #box .up{top:10px;background-position:0 0;} #box .down{bottom:10px;background-position:0 bottom;} #box ul{position:absolute;width:160px;} #box li{width:160px;height:190px;list-style:none;text-align:center;} #box a{color:#fff;font-weight:700;text-decoration:none;} #box img{width:156px;height:156px;display:block;margin-bottom:5px;border:2px solid #ccc;} </style> <script type="text/javascript"> //获取id function $ (id) { return typeof id === "string" ? document.getElementById(id) : id; } //获取tagName function $$ (elem, oParent) { return (oParent || document).getElementsByTagName(elem); } //获取class function $$$ (className, oParent) { var aClass = []; var reClass = new RegExp("(//s|^)" + className + "($|//s)"); var aElem = $$("*", oParent); for (var i = 0; i < aElem.length; i++) reClass.test(aElem[i].className) && aClass.push(aElem[i]); return aClass } //初始化对象 function Roll () { this.initialize.apply(this, arguments) } Roll.prototype = { initialize: function (obj) { var _this = this; this.obj = $(obj); this.oUp = $$$("up", this.obj)[0]; this.oDown = $$$("down", this.obj)[0]; this.oList = $$$("list", this.obj)[0]; this.aItem = this.oList.children; this.timer = null; this.iNow = 0; this.iHeight = this.aItem[0].offsetHeight; this.oUp.onclick = function () { _this.up() }; this.oDown.onclick = function () { _this.down() } }, up: function () { this.oList.insertBefore(this.aItem[this.aItem.length - 1], this.oList.firstChild); this.oList.style.top = -this.iHeight + "px"; this.doMove(0) }, down: function () { this.doMove(-this.iHeight, function () { this.oList.appendChild(this.aItem[0]); this.oList.style.top = 0; }) }, doMove: function (iTarget, callBack) { var _this = this; clearInterval(this.timer) this.timer = setInterval(function () { var iSpeed = (iTarget - _this.oList.offsetTop) / 5; iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed); _this.oList.offsetTop == iTarget ? (clearInterval(_this.timer), callBack && callBack.apply(_this)) : _this.oList.style.top = iSpeed + _this.oList.offsetTop + "px" }, 30) } }; window.onload = function () { new Roll("box"); }; </script> </head> <body> <div id="box"> <span class="up">up</span> <span class="down">down</span> <div> <ul class="list"> <li><a href="javascript:;"><img src="http://js.aiyiweb.com/img/201108/1.jpeg" />Ozolio - Webcam Hosting</a></li> <li><a href="javascript:;"><img src="http://js.aiyiweb.com/img/
上一篇:狡猾的按钮特效
下一篇:向上下左右不间断无缝滚动图片的效果(兼容火狐和IE)
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
微博启动自媒体计划 粉丝+收入双激励是亮点
PC迎9年来出货量新低 平板电脑渐成主流
HTC的三大迷惘:高管釜底抽薪 产品营销战略混乱
看蜗牛如何放水养鱼,盘活生态系统
独立工具APP:为亿级用户的商业化而愁
评论:阿里为什么不试着收购一家香港媒体呢
微软小冰复活再战移动端:改与米聊、易信和触宝合作
HDS发布《2013中国CIO洞察白皮书》
雷军收买腾讯金山股份:持股比例升至27%
推荐阅读
更多>
中移动五大基地将整改成公司:被指易滋生腐败
百度对糯米来说到底意味着什么?
新一代iPhone11月底国内上市 支持TD制式
挂号网高管团体离任 或因投资人失掉决计
云智慧:用大数据实现企业应用性能管理
用友软件股价逆势下跌 再融资方案现曙光
P2P平台科迅网疑“跑路” 涉及金额超2700万
谷歌董事长成花花公子:情史足以媲美涂鸦
亚马逊第三方平台真的卖盗版书?
网络视频的几大趋势将成视频玩家躲不开的发力点
易迅大众点评缩水执行“七天后悔权”被约谈
说说这一个月的赌球输了多少
从百度世界大会看大数据
继续涨:微博IPO第二交易日 收盘大涨11.71%
评论:马云的成功建立在什么基础上很值得怀疑
机器人进一步取代人类:将进军白领任务
中国联通困局:遭遇OTT宽带4G三大难题
诺基亚再缩阵线 封锁上海旗舰店全力蜕变
揭秘:阿里巴巴“无人认领”的三成股权都归谁
中国电信内外受困 去电信化思绪待改