爱易网
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 浏览次数:20213 次
以下是程序代码
<!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)
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
从百度世界大会看大数据
微软觊觎移动互联市场:手机未出渠道先行
魅族黄章惹怒芙蓉姐姐 将跨界推女神手机
电信资费新政:三巨头压力大 短期降价仍有争议
薛蛮子取保后首次发微博表示:辜负你们了
蓝宝石PK大猩猩玻璃:作为屏幕谁更有优势?
传苹果与雅虎协作信息提供 进一步摆脱谷歌
CSS控制字符长度和显示长度
阿里物流搭上邮政:京东,我们在终点等你!
推荐阅读
更多>
小米打响手机价格战 为米3铺路或另有所图
Docker Desktop 4.11 发布:支持虚拟桌面、Mac 权限更改和新扩展
苹果CEO抱歉解读:是战略而非“屈服”
新闻早8点》Facebook失手发布Snapchat类应用
iPhone 6 Plus要召回是谣言
国美痛批网购七宗罪 用短暂盈利输了未来
史玉柱谈创业:5大建议 失败的教训最真实
弯曲变形:手机全新的交互方式
Kindle入华遭遇国内厂商“围剿 ” 电信也参战
频繁自杀 折射媒体变革中的媒体人迷茫与压力并存
传运营商高层将变化 专家称需体制革新
华为变阵:任正非调整三大业务布局
微软的云服务显示出他们将自我进化
不提老罗,不说情怀,仅从十四个投诉问题入手谈锤子手机
快递企业征收“份子钱” 成全了谁 苦了谁?
中国首台比特币ATM登陆上海 可购买不可兑换现钞
广电总局回应美剧下架:不是所有信息可公开
阿里国际化再落子:2.49亿美元投资新加坡邮政
小米移动芯片:英伟达退出,终会加强与联发科合作
工信部或本月17日向联通电信颁发FDD牌照