爱易网
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 浏览次数:20127 次
以下是程序代码
<!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)
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
FDD牌照短期不会发放 联通电信暗自提速建网
电信业营改增今起实施 运营商短期利润骤降
网易云音乐能否为丁磊拿到移动互联网门票?
让一让,小米4来了,碰见米粉请务必绕道走!
苹果已经允许开发者提交64位应用程序
三星石墨烯制备技术获突破
微软史上最大规模裁员,一半诺基亚员工
传苹果与雅虎协作信息提供 进一步摆脱谷歌
京东很忙:升服务推产品更新招股书 能赶在阿里前上市?
推荐阅读
更多>
马云自称在美国曾被绑票
三星维修新规:Galaxy S4主板进水也收费修
阿里国际化再落子:2.49亿美元投资新加坡邮政
9月1日起免征新能源汽车购置税
阿里马云:我觉得互联网还有十年可以做
墨迹天气:产品创新以攻为守方能对抗巨头
锐迪科将以9.25美元/ADS价钱出售835万份ADS
韩国研制无线充电系统:一次可充40部手机
阿里收购UC 五年姻缘换来移动新格局
三大运营商合建铁塔公司真相:未涉及电信业重组
新浪微博推粉丝头条功能 意欲与大号分成
京东物流"最后一公里":颠覆阿里或者被阿里干掉
2018双11阿里云老用户怎么参加拼团活动 老用户拼团方法
戴尔新CEO名单曝光:惠普甲骨文高管在列
CSS控制字符长度和显示长度
埃里克杰克森:阿里IPO估值至少1500亿美元
马云:银行若放开存款利率 余额宝死了也光荣
摩托罗拉中国区将再裁员 助力公司变身
苹果6月20日发布iPhone5S 触摸屏概念股生动
迅雷再次在美提交IPO申请