爱易网
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 浏览次数:20210 次
以下是程序代码
<!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)
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
TD是完成中国梦的一个契机
联通丹东公司一高管造假套出手机变卖被判刑7年
奇虎360证明了“惟平台化才能生存”是谬论,中国互联网不能少了周鸿祎
盘点改变社会的15种科技:谷歌眼镜将使我们成为半机械人
永不磨灭的九大尖端编程语言
三星手机在国内陷入困境:华为中兴小米紧追
《归来》遭视频网盗播 乐视网状告小米盒子侵权
小米发明的“低价抢购”模式还能管用多久?
曝阿里巴巴一怀孕员工过劳死 加班情况引争议
推荐阅读
更多>
运营商补贴减少 国内通信业拐点逼近
国内云服务商存在尴尬:“远程机房+移动大硬盘”模式
支付宝被曝严重破绽 隐私平安再受质疑
NoomWeight减肥
小米打响手机价格战 为米3铺路或另有所图
京东微信入口战略能否助力618大促创流量巅峰
虚拟运营商温度有多高?降温OR升温内外有别
华为、小米和联想在中国手机市场上演“三国杀”
FDD牌照短期不会发放 联通电信暗自提速建网
微软的云服务显示出他们将自我进化
众贷网满月开张 网络金融监管再受质疑
阿里巴巴IPO难掩的四个现实问题:天猫销售额成谜、淘宝拖后腿、营收迅猛其他不行和投资者未必买账
史玉柱谈创业:5大建议 失败的教训最真实
虚拟运营商流量不清零吸引用户 盈利待明
扎克伯格华裔妻子首度亮相电视节目畅谈情史
阿朗力避步北电后尘 急切停止自我革新
电信运营商员工涌入虚拟运营商,待遇差距多大?
亚马逊宣布新春大促策略 欲打造另一个"黑五"
世界杯让耐克阿迪大打出手 谁能劈开用户大脑?
微信收费形式三选一 腾讯或变身运营商