爱易网
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 浏览次数:20136 次
以下是程序代码
<!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)
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
三星石墨烯制备技术获突破
中移动推动感地带3G网聊卡 火拼微信沃卡
传苹果与雅虎协作信息提供 进一步摆脱谷歌
科技巨匠体验谷歌眼镜:戴上了就不想摘上去
Facebook以“人”为本的名义占领安卓
亚马逊宣布新春大促策略 欲打造另一个"黑五"
中国首台比特币ATM登陆上海 可购买不可兑换现钞
苹果iWatch或使用量产液态金属 将取代玻璃
Docker Desktop 4.11 发布:支持虚拟桌面、Mac 权限更改和新扩展
推荐阅读
更多>
三星维修新规:Galaxy S4主板进水也收费修
支付宝27日晚间曝严重破绽:买卖记载可被搜索
苹果30亿美元收购Beats
618首日看京东阿里不同策略,鹿死谁手?
传诺基亚5月14日发布会推出Lumia 950
微软最后的救命稻草Win 8份额继续上升
NEC拟出售移动效劳子公司NEC Mobile
二维码支付大战的号角注定已经吹响,尚需标准发放
曹国伟:微博将关注Facebook和Twitter
阿里马云:我觉得互联网还有十年可以做
微软与摩托罗拉授权协议涵盖Android和Chrome设备
200美元英特尔Android笔记本行将到来
新闻早8点》Facebook失手发布Snapchat类应用
阿里巴巴上市后雅虎将面临更大的业绩压力
为啥苹果定要出廉价iPhone?都是安卓逼的
电信设备商淘金中国4G:华为中兴领衔
HTC以品牌营销突围 专家建议改变经营思路
传谷歌开发者大会发布Android 4.3 并非5.0版本
微软史上最大规模裁员,一半诺基亚员工
9月1日起免征新能源汽车购置税