博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
图片翻转3D效果
阅读量:5097 次
发布时间:2019-06-13

本文共 7171 字,大约阅读时间需要 23 分钟。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD>

<META content="text/html; charset=gb2312" http-equiv=Content-Type>

<STYLE>HTML {

BACKGROUND: #000

}

BODY {

PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px

}

UL {

PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px

}

LI {

LIST-STYLE-TYPE: none; LIST-STYLE-IMAGE: none

}

IMG {

BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; DISPLAY: block; BORDER-TOP: medium none; BORDER-RIGHT: medium none

}

.slide-wp {

POSITION: absolute; MARGIN-TOP: -150px; WIDTH: 520px; HEIGHT: 280px; MARGIN-LEFT: -250px; OVERFLOW: hidden; TOP: 50%; LEFT: 50%

}

.nav-wp {

POSITION: absolute; PADDING-BOTTOM: 6px; MARGIN-TOP: 170px; PADDING-LEFT: 10px; PADDING-RIGHT: 20px; BACKGROUND: #ccc; MARGIN-LEFT: -100px; TOP: 50%; PADDING-TOP: 0px; LEFT: 50%; border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; _padding: 0 20px 2px 10px

}

.nav LI {

FONT-FAMILY: tahoma; FLOAT: left; HEIGHT: 22px; COLOR: #22739e; MARGIN-LEFT: 10px; FONT-SIZE: 20px; CURSOR: pointer; FONT-WEIGHT: bold

}

.nav LI.cur {

COLOR: #ff7a00

}

.next {

POSITION: absolute; PADDING-BOTTOM: 4px; PADDING-LEFT: 8px; PADDING-RIGHT: 8px; BACKGROUND: #ccc; HEIGHT: 20px; COLOR: #ff7a00; TOP: 0px; CURSOR: pointer; PADDING-TOP: 4px; LEFT: 160px; border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px

}

</STYLE>

 

<META name=GENERATOR content="MSHTML 8.00.6001.19222"></HEAD>

<BODY>

<H2 style="COLOR: #fff">对于使用IE6的同学看到的斑点,我只能表示很无奈。。。</H2>

<DIV id=slider class=slide-wp>

<UL>

  <LI><A href="http://www.nowamagic.net/" target=_blank><IMG alt="" 

  src="3d_files/1.jpg"></A></LI>

  <LI><A href="http://www.nowamagic.net/" target=_blank><IMG alt="" 

  src="3d_files/2.jpg"></A></LI>

  <LI><A href="http://www.nowamagic.net/" target=_blank><IMG alt="" 

  src="3d_files/3.jpg"></A></LI>

  <LI><A href="http://www.nowamagic.net/" target=_blank><IMG alt="" 

  src="3d_files/4.jpg"></A></LI>

  <LI><A href="http://www.nowamagic.net/" target=_blank><IMG alt="" 

  src="3d_files/5.jpg"></A></LI></UL></DIV>

<DIV class=nav-wp>

<UL id=nav class=nav>

  <LI οnclick=mySlider.pos(0)>●</LI>

  <LI οnclick=mySlider.pos(1)>●</LI>

  <LI οnclick=mySlider.pos(2)>●</LI>

  <LI οnclick=mySlider.pos(3)>●</LI>

  <LI οnclick=mySlider.pos(4)>●</LI></UL><A class=next 

οnclick=mySlider.move()>next</A> </DIV>

<SCRIPT type=text/javascript>

var HR = {

 $ : function(i) {return document.getElementById(i)},

 $$ : function(c, p) {return p.getElementsByTagName(c)},

 ce : function(i, t) {

  var o = document.createElement(i);

  t.appendChild(o);

  return o;

 }

};

HR.slider3D = function () {

 var init = function (o) {

  this.o = o;

  var wp = HR.$(o.id), ul = HR.$$('ul', wp)[0], li = this.li = HR.$$('li', ul);

  this.l = li.length;

  this.w = wp.offsetWidth;

  this.h = wp.offsetHeight;

  this.at = o.auto? o.auto : 4;

  var con = this.con = HR.ce('div', wp);

  con.style.cssText = 'position:absolute;left:0;top:0;width:'+this.w+'px;height:'+this.h+'px';

  ul.style['display'] = 'none';  

  this.a1 = HR.ce('a', con);  

  this.a1.style.cssText = 'position:absolute;left:0;top:0;overflow:hidden';  

  this.a2 = HR.ce('a', con);

  this.a2.style.cssText = 'position:absolute;top:0;right:0;overflow:hidden';

  this.a1.innerHTML = this.a2.innerHTML = '<img alt="" />';

  this.img = HR.$$('img', ul);

  this.s = o.maskSize ? o.maskSize : 5;

  

  this.mask11 = HR.ce('span', this.a1);

  this.mask12 = HR.ce('span', this.a1);

  this.mask21 = HR.ce('span', this.a2);

  this.mask22 = HR.ce('span', this.a2);

  

  this.pos(0);

 }

 init.prototype = {

  pos : function (i) {

   clearInterval(this.li[i].a); clearInterval(this.au); this.au = 0; this.cur = i;

   var navli = HR.$$('li', HR.$(this.o.navId));

   for (var j=0; j<navli.length; j++) {

    navli[j].className = i == j ? 'cur' : '';

   }

   var img1 = HR.$$('img', this.a1)[0], img2 = HR.$$('img', this.a2)[0], _this = this;

   img1.src = i==0 ? this.img[this.l-1].src : this.img[i-1].src;

   img1.width = this.w;

   img2.src = this.img[i].src;

   img2.width = 0;

   img1.height = img2.height = this.h;

   this.mask11.style.cssText = 'position:absolute;left:0;top:0;font-size:0;overflow:hidden;width:0;height:0;border-color:black transparent transparent black;border-style:solid dashed dashed solid;border-width:0 '+this.w/2+'px';

   this.mask12.style.cssText = 'position:absolute;left:0;bottom:0;font-size:0;overflow:hidden;width:0;height:0;border-color:transparent transparent black black;border-style:dashed dashed solid solid;border-width:0 '+this.w/2+'px';

   this.mask21.style.cssText = 'position:absolute;right:0;top:0;font-size:0;overflow:hidden;width:0;height:0;border-color:black black transparent transparent;border-style:solid solid dashed dashed;border-width:0px';

   this.mask22.style.cssText = 'position:absolute;right:0;bottom:0;font-size:0;overflow:hidden;width:0;height:0;border-color:transparent black black transparent;border-style:dashed solid solid dashed;border-width:0px';

   this.li[i].a = setInterval(function(){_this.anim(i)}, 20);

  },

  anim : function (i) {

   var w1 = HR.$$('img', this.a1)[0].width, w2  = HR.$$('img', this.a2)[0].width;

   if (w2 == this.w) {

    clearInterval(this.li[i].a);

    HR.$$('img', this.a1)[0].width = 0;

    HR.$$('img', this.a2)[0].width = this.w;

    this.mask11.style.borderLeftWidth = this.mask11.style.borderRightWidth = this.mask12.style.borderLeftWidth = this.mask12.style.borderRightWidth = '0px';

    this.mask11.style.borderTopWidth = this.mask11.style.borderBottomWidth = this.mask12.style.borderTopWidth = this.mask12.style.borderBottomWidth = this.h/this.s + 'px';

    this.mask21.style.borderLeftWidth = this.mask21.style.borderRightWidth = this.mask22.style.borderLeftWidth = this.mask22.style.borderRightWidth = this.w/2 + 'px';

    this.mask21.style.borderTopWidth = this.mask21.style.borderBottomWidth = this.mask22.style.borderTopWidth = this.mask22.style.borderBottomWidth = '0px';

   }else {

    HR.$$('img', this.a1)[0].width -= Math.ceil((this.w-w2)*.13);

    HR.$$('img', this.a2)[0].width += Math.ceil((this.w-w2)*.13);

    this.mask11.style.borderLeftWidth = this.mask11.style.borderRightWidth = this.mask12.style.borderLeftWidth = this.mask12.style.borderRightWidth = HR.$$('img', this.a1)[0].width/2 + 'px';

    this.mask11.style.borderTopWidth = this.mask11.style.borderBottomWidth = this.mask12.style.borderTopWidth = this.mask12.style.borderBottomWidth = HR.$$('img', this.a2)[0].width*this.h/(this.s*this.w) + 'px';

    this.mask21.style.borderLeftWidth = this.mask21.style.borderRightWidth = this.mask22.style.borderLeftWidth = this.mask22.style.borderRightWidth = HR.$$('img', this.a2)[0].width/2 + 'px';

    this.mask21.style.borderTopWidth = this.mask21.style.borderBottomWidth = this.mask22.style.borderTopWidth = this.mask22.style.borderBottomWidth = this.h/this.s - HR.$$('img', this.a2)[0].width*this.h/(this.s*this.w) + 'px';

    if (!this.au) this.auto();

   }

  },

  auto : function () {

   var _this = this;

   this.au = setInterval(function(){_this.move()}, this.at*1000);

  },

  move : function () {

   var n = this.cur==this.l-1 ? 0 : this.cur+1;

   this.pos(n);

  }

 }

 return init;

}();

var mySlider = new HR.slider3D({

 id: 'slider',

 maskSize: 6,

 navId: 'nav',

 auto: 4

})</SCRIPT>

</BODY></HTML>

转载于:https://www.cnblogs.com/xinzhuangzi/archive/2012/04/17/4100398.html

你可能感兴趣的文章
字符环(openjudge 2755)
查看>>
php match_model的简单使用
查看>>
在NT中直接访问物理内存
查看>>
Intel HEX 文件格式
查看>>
SIP服务器性能测试工具SIPp使用指导(转)
查看>>
Centos Development Tools 安装
查看>>
vue form 验证
查看>>
php_扑克类
查看>>
回调没用,加上iframe提交表单
查看>>
socket总结
查看>>
(安卓)一般安卓开始界面 Loding 跳转 实例 ---亲测!
查看>>
元素和为目标值的子矩阵数量
查看>>
POJ-1287.Network(Kruskal + Prim + Prim堆优化)
查看>>
Mysql 索引优化 - 1
查看>>
LeetCode(3) || Median of Two Sorted Arrays
查看>>
JSDoc规范
查看>>
大话文本检测经典模型:EAST
查看>>
文本主题模型之LDA(一) LDA基础
查看>>
linux基础命令-chgrp/chown/chomd
查看>>
待整理
查看>>