js之3D轮播图
.gif)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0036)http://fgm.cc/learn/lesson10/08.html -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>仿腾讯游戏《英雄杀》官网Flash效果</title>
<style type="text/css">
body,div,ul,li,h4,p{margin:0;padding:0;}
body{font:12px/1.8 arial;color:#fff;background:url(img/yxs/home_bg.jpg) 50% 0 no-repeat #000;}
a{color:#fff;text-decoration:none;background:#666;padding:2px 5px;}
a:hover{background:#F90;}
#box{position:relative;width:754px;height:292px;margin:115px auto 0;}
#box ul{position:relative;width:754px;height:292px;}
#box li{position:absolute;border:2px solid #000;list-style:none;background:#000;width:0;height:0;top:146px;left:377px;z-index:0;cursor:pointer;overflow:hidden;border-radius:3px;}
#box li img{width:100%;height:100%;vertical-align:top;}
#box li div{position:absolute;bottom:-100px;width:100%;height:100px;background:#000;filter:alpha(opacity=70);opacity:0.7;}
#box li div h4{margin:0 10px;font:12px/24px arial;border-bottom:1px #333 solid;}
#box li div h4 span{color:red;margin-left:10px;}
#box li div p{margin:5px 10px 0;text-indent:2em;}
#box .prev, #box .next{position:absolute;top:50%;width:39px;height:80px;margin-top:-40px;overflow:hidden;text-indent:-999px;cursor:pointer;background:url(img/yxs/btn.png) no-repeat;}
#box .prev{left:-60px;}
#box .next{right:-60px;background-position:-39px 0;}
#copyright{padding-top:10px;text-align:center;}
</style>
<script type="text/javascript">
function ZoomPic ()
{
this.initialize.apply(this, arguments)
}
ZoomPic.prototype =
{
initialize : function (id)
{
var _this = this;
this.wrap = typeof id === "string" ? document.getElementById(id) : id;
this.oUl = this.wrap.getElementsByTagName("ul")[0];
this.aLi = this.wrap.getElementsByTagName("li");
this.prev = this.wrap.getElementsByTagName("pre")[0];
this.next = this.wrap.getElementsByTagName("pre")[1];
this.timer = null;
this.aSort = [];
this.iCenter = 3;
this._doPrev = function () {return _this.doPrev.apply(_this)};
this._doNext = function () {return _this.doNext.apply(_this)};
this.options = [
{width:120, height:150, top:71, left:134, zIndex:1},
{width:130, height:170, top:61, left:0, zIndex:2},
{width:170, height:218, top:37, left:110, zIndex:3},
{width:224, height:288, top:0, left:262, zIndex:4},
{width:170, height:218, top:37, left:468, zIndex:3},
{width:130, height:170, top:61, left:620, zIndex:2},
{width:120, height:150, top:71, left:496, zIndex:1}
];
for (var i = 0; i < this.aLi.length; i++) this.aSort[i] = this.aLi[i];
this.aSort.unshift(this.aSort.pop());
this.setUp();
this.addEvent(this.prev, "click", this._doPrev);
this.addEvent(this.next, "click", this._doNext);
this.doImgClick();
this.timer = setInterval(function ()
{
_this.doNext()
}, 3000);
this.wrap.onmouseover = function ()
{
clearInterval(_this.timer)
};
this.wrap.onmouseout = function ()
{
_this.timer = setInterval(function ()
{
_this.doNext()
}, 3000);
}
},
doPrev : function ()
{
this.aSort.unshift(this.aSort.pop());
this.setUp()
},
doNext : function ()
{
this.aSort.push(this.aSort.shift());
this.setUp()
},
doImgClick : function ()
{
var _this = this;
for (var i = 0; i < this.aSort.length; i++)
{
this.aSort[i].onclick = function ()
{
if (this.index > _this.iCenter)
{
for (var i = 0; i < this.index - _this.iCenter; i++) _this.aSort.push(_this.aSort.shift());
_this.setUp()
}
else if(this.index < _this.iCenter)
{
for (var i = 0; i < _this.iCenter - this.index; i++) _this.aSort.unshift(_this.aSort.pop());
_this.setUp()
}
}
}
},
setUp : function ()
{
var _this = this;
var i = 0;
for (i = 0; i < this.aSort.length; i++) this.oUl.appendChild(this.aSort[i]);
for (i = 0; i < this.aSort.length; i++)
{
this.aSort[i].index = i;
if (i < 7)
{
this.css(this.aSort[i], "display", "block");
this.doMove(this.aSort[i], this.options[i], function ()
{
_this.doMove(_this.aSort[_this.iCenter].getElementsByTagName("img")[0], {opacity:100}, function ()
{
_this.doMove(_this.aSort[_this.iCenter].getElementsByTagName("img")[0], {opacity:100}, function ()
{
_this.aSort[_this.iCenter].onmouseover = function ()
{
_this.doMove(this.getElementsByTagName("div")[0], {bottom:0})
};
_this.aSort[_this.iCenter].onmouseout = function ()
{
_this.doMove(this.getElementsByTagName("div")[0], {bottom:-100})
}
})
})
});
}
else
{
this.css(this.aSort[i], "display", "none");
this.css(this.aSort[i], "width", 0);
this.css(this.aSort[i], "height", 0);
this.css(this.aSort[i], "top", 37);
this.css(this.aSort[i], "left", this.oUl.offsetWidth / 2)
}
if (i < this.iCenter || i > this.iCenter)
{
this.css(this.aSort[i].getElementsByTagName("img")[0], "opacity", 30)
this.aSort[i].onmouseover = function ()
{
_this.doMove(this.getElementsByTagName("img")[0], {opacity:100})
};
this.aSort[i].onmouseout = function ()
{
_this.doMove(this.getElementsByTagName("img")[0], {opacity:35})
};
this.aSort[i].onmouseout();
}
else
{
this.aSort[i].onmouseover = this.aSort[i].onmouseout = null
}
}
},
addEvent : function (oElement, sEventType, fnHandler)
{
return oElement.addEventListener ? oElement.addEventListener(sEventType, fnHandler, false) : oElement.attachEvent("on" + sEventType, fnHandler)
},
css : function (oElement, attr, value)
{
if (arguments.length == 2)
{
return oElement.currentStyle ? oElement.currentStyle[attr] : getComputedStyle(oElement, null)[attr]
}
else if (arguments.length == 3)
{
switch (attr)
{
case "width":
case "height":
case "top":
case "left":
case "bottom":
oElement.style[attr] = value + "px";
break;
case "opacity" :
oElement.style.filter = "alpha(opacity=" + value + ")";
oElement.style.opacity = value / 100;
break;
default :
oElement.style[attr] = value;
break
}
}
},
doMove : function (oElement, oAttr, fnCallBack)
{
var _this = this;
clearInterval(oElement.timer);
oElement.timer = setInterval(function ()
{
var bStop = true;
for (var property in oAttr)
{
var iCur = parseFloat(_this.css(oElement, property));
property == "opacity" && (iCur = parseInt(iCur.toFixed(2) * 100));
var iSpeed = (oAttr[property] - iCur) / 5;
iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed); if (iCur != oAttr[property])
{
bStop = false;
_this.css(oElement, property, iCur + iSpeed)
}
}
if (bStop)
{
clearInterval(oElement.timer);
fnCallBack && fnCallBack.apply(_this, arguments)
}
}, 30)
}
};
window.onload = function ()
{
new ZoomPic("box");
};
</script>
</head>
<body>
<div id="box">
<pre class="prev">prev</pre>
<pre class="next">next</pre>
<ul>
<li style="display: block; width: 120px; height: 150px; top: 71px; left: 131px; z-index: 1;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/10.jpg" style="opacity: 0.35;"><div style="bottom: -100px;"><h4>杨延昭<span>天狼星</span></h4><p>杨延昭是北宋抗辽大将杨业的长子,自幼就受到其父抵抗契丹、收复失地的思想影响。</p></div></li><li style="display: block; width: 130px; height: 170px; top: 61px; left: 2px; z-index: 2;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/11.jpg" style="opacity: 0.35;"><div style="bottom: -100px;"><h4>关羽<span>武圣</span></h4><p>关羽,字云长,本字长生,河东解县人(今山西省运城市),东汉末年三国时期刘备的重要将领。</p></div></li><li style="display: block; width: 170px; height: 218px; top: 37px; left: 114px; z-index: 3;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/12.jpg" style="opacity: 0.35;"><div><h4>鲁智深<span>花和尚</span></h4><p>鲁智深,梁山泊第十三位好汉,绰号花和尚。因为见郑屠欺侮金翠莲父女,三拳打死了镇关西。</p></div></li><li style="display: block; width: 224px; height: 288px; top: 0px; left: 267px; z-index: 4;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/13.jpg" style="opacity: 0.35;"><div><h4>赢政<span>秦始皇</span></h4><p>秦始皇,赢姓,赵氏,名政,秦庄襄王之子。秦始皇22岁时,在雍城举行国君成人加冕仪式。开始"亲理朝政"。</p></div></li><li style="display: block; width: 170px; height: 218px; top: 37px; left: 472px; z-index: 3;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/14.jpg" style="opacity: 0.35;"><div><h4>赵匡胤<span>宋太祖</span></h4><p>赵匡胤,中国北宋王朝的建立者,庙号太祖,汉族,涿州(今河北)人。出身军人家庭。高祖赵眺,祖父赵敬。</p></div></li><li style="display: block; width: 130px; height: 170px; top: 61px; left: 617px; z-index: 2;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/1.jpg" style="opacity: 0.35;"><div><h4>小乔<span>国色天香</span></h4><p>小乔,三国时期的主要女性人物之一。在三国时归属吴国,国色流离、资貌绝伦,是当时有名的东吴美女。</p></div></li><li style="display: block; width: 117px; height: 146px; top: 71px; left: 493px; z-index: 1;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/2.jpg" style="opacity: 0.35;"><div><h4>潘安<span>花样美男</span></h4><p>潘安,西晋文学家,本名潘岳。中国古代最著名的美男子之首、"金谷二十四友"之首。</p></div></li><li style="display: none; width: 0px; height: 0px; top: 37px; left: 377px; z-index: 1;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/3.jpg" style="opacity: 0.35;"><div style="bottom: -100px;"><h4>朱元璋<span>明太祖</span></h4><p>朱元璋,明王朝的开国皇帝,建立了全国统一的封建政权。</p></div></li><li style="display: none; width: 0px; height: 0px; top: 37px; left: 377px; z-index: 1;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/4.jpg" style="opacity: 0.35;"><div><h4>吕雉<span>吕后</span></h4><p>吕雉,西汉开国皇帝高祖刘邦的原配夫人,中国历史上第一位掌权的女性统治者。</p></div></li><li style="display: none; width: 0px; height: 0px; top: 37px; left: 377px; z-index: 1;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/5.jpg" style="opacity: 0.35;"><div><h4>诸葛亮<span>卧龙</span></h4><p>诸葛亮,蜀汉丞相,三国时期杰出的政治家、战略家、发明家、军事家。</p></div></li><li style="display: none; width: 0px; height: 0px; top: 37px; left: 377px; z-index: 1;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/6.jpg" style="opacity: 0.35;"><div><h4>李师师<span>青楼歌妓</span></h4><p>李师师,北宋末年色艺双绝的名妓,其事迹多见于野史,笔记小说。据传曾深受宋徽宗喜爱。</p></div></li><li style="display: none; width: 0px; height: 0px; top: 37px; left: 377px; z-index: 1;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/7.jpg" style="opacity: 0.35;"><div><h4>陈圆圆<span>乱世红颜</span></h4><p>陈圆圆,名沅,明末清初苏州名姬,浙江金华人氏。"容辞闲雅,额秀頣丰",有名士大家风度。</p></div></li><li style="display: none; width: 0px; height: 0px; top: 37px; left: 377px; z-index: 1;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/8.jpg" style="opacity: 0.35;"><div><h4>扁鹊<span>神医</span></h4><p>扁鹊精于内、外、妇、儿、五官等科,应用针灸、按摩、汤药、热熨等法治疗疾病,被尊为医祖。</p></div></li><li style="display: none; width: 0px; height: 0px; top: 37px; left: 377px; z-index: 1;"><img src="./仿腾讯游戏《英雄杀》官网Flash效果_files/9.jpg" style="opacity: 0.35;"><div><h4>西施<span>西子</span></h4><p>西施,名夷光,春秋时间越国人,今浙江诸暨市城关苎萝村。同范蠡同卒于陶(定陶)。</p></div></li></ul>
</div>
<div id="copyright">如蒙转载请注明出处 <a href="http://js.fgm.cc/">Fgm.cc</a> , By — Ferris, QQ:21314130</div> </body></html>
js之3D轮播图的更多相关文章
- jQuery与原生js实现banner轮播图
jQuery与原生js实现banner轮播图: (jq需自己加载)(图片需自己加载) <!DOCTYPE html> <html> <head> <meta ...
- 原生JS实现简易轮播图
原生JS实现简易轮播图(渐变?) 最近做网页总是会用到轮播图,我就把之前写的轮播图单独拿出来吧,如果有...如果真的有人也需要也可以复制去用用啊..哈~.. window.onload = funct ...
- CSS3之3D轮播图
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- JS+css3焦点轮播图PC端
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- js原生实现轮播图效果(面向对象编程)
面向对象编程js原生实现轮播图效果 1.先看效果图 2.需要实现的功能: 自动轮播 点击左右箭头按钮无缝轮播 点击数字按钮切换图片 分析:如何实现无缝轮播? 在一个固定大小的相框里有一个ul标签,其长 ...
- JS学习笔记--轮播图效果
希望通过自己的学习收获哪怕收获一点点,进步一点点都是值得的,加油吧!!! 本章知识点:index this for if else 下边我分享下通过老师教的方式写的轮播图,基础知识实现: 1.css代 ...
- 3d轮播图(另一种方式,可以实现的功能更为强大也更为灵活,简单一句话,比酷狗优酷的炫)
前不久我做了一个3d仿酷狗的轮播图,用的技术原理就是简单的jquery遍历+css样式读写. 这次呢,我们换一种思路(呵呵其实换汤不换药),看到上次那个轮播吗?你有没有发现用jquery的animat ...
- 3d轮播图——类似酷狗的轮播
说到轮播图,其实只要是跟web开发相关的无论是前端后端应该都不陌生,各种各样的轮播图,从以前的单纯的平面山水画遮盖滑动或滚动,到Jquery的animate甚至是h5+css3,各种炫酷的轮播图更是层 ...
- 原生 js 左右切换轮播图
使用方法: 可能很多人对轮播图感兴趣,下面奉上本人的 原生 js 轮播代码复制 js 到页面的最底部,样式在 css 里改,js 基本不用动,有什么不懂的可以 加本人 QQ172360937 咨询 或 ...
随机推荐
- 在使用Vue.js中使用axios库时,遇到415错误(不支持的媒体类型(Unsupported media type))
知识点:vue2.0中使用axios进行(put,post请求时),遇到415错误 解决办法:在axios的第三个参数config中,设置请求头信息'Content-Type': 'applicati ...
- UVA 1642 Magical GCD(经典gcd)
题意:给你n(n<=100000)个正整数,求一个连续子序列使序列的所有元素的最大公约数与个数乘积最大 题解:我们知道一个原理就是对于n+1个数与n个数的最大公约数要么相等,要么减小并且减小至少 ...
- mongodb可视化客户端下载
网站:https://www.mongodbmanager.com/files/ 直接下载:https://www.mongodbmanager.com/files/mongodbmanagerpro ...
- POJ 1236 Network of School
http://poj.org/problem?id=1236 题意: 给出一个图,至少要选多少个点才能遍历全图和至少需要添加多少边使得整个图是强连通. 思路: 强连通计算连通分量后缩点,计算入度为0的 ...
- ubuntu install vue , vue-cli , how to create project..
<<install node.js <<the n model is manage the node.js version npm install -g n n stable ...
- jQuery回车键快速切换下一个input文本框解决方案
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 如何选择正确的angular2学习曲线?
参考: https://www.zhihu.com/question/50800464/answer/122921043 https://www.zhihu.com/question/48670501 ...
- R-模式(mode)和类(class)
数据模式:mode函数显示任何对象的模式.常见的单个的对象模式是逻辑型(Logical).数值型(Numeric).字符型(Character). 常用到的数据模式是列表(list). 逻辑型:TRU ...
- 20165332 2017-2018-2《Java程序设计》课程总结
20165332 2017-2018-2<Java程序设计>课程总结 一.每周作业及实验报告链接汇总 我期望的师生关系 学习基础和c语言基础调查 Linux安装及命令入门 第一周学习总结 ...
- Android-----代码实现打开手机第三方应用APP
最近做一个项目,有一个需要启动第三方应用,和微信的地图查看差不多,需要启动高德,百度或腾讯地图来查看:特来分享,希望有所帮助. 案例效果如图: 要想启动第三方:首先要知道他的包名 一:高德 高德:co ...