类似于flash制作的一个图片展示.txt

来自「网页特效的代码,在美化网页时有很大的作用」· 文本 代码 · 共 485 行

TXT
485
字号

<HTML><HEAD><TITLE>类似于Flash制作的一个图片展示效果</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META http-equiv=imagetoolbar content=no>
<STYLE type=text/css>BODY {
	PADDING-RIGHT: 0px;
	PADDING-LEFT: 0px;
	BACKGROUND: #222;
	LEFT: 0px;
	PADDING-BOTTOM: 0px;
	MARGIN: 0px;
	OVERFLOW: hidden;
	WIDTH: 100%;
	CURSOR: crosshair;
	PADDING-TOP: 0px;
	POSITION: absolute;
	TOP: 0px;
	HEIGHT: 100%;
	zIndex: -2;
	background-color: #FFFFFF;
}
</STYLE>

<SCRIPT type=text/javascript>

window.onerror = new Function("return true");

screen.bufferDepth = 16;

document.onselectstart = function () { return false; }



////////////////////////////

var NX     = 3;

var NY     = 3;

var SP     = 20;

var DELAY  = 96;

////////////////////////////



var object = new Array();

var nI     = 0;

var run    = false;

var xrun   = 0;

var dR     = 1;

var iW     = 0;

var iH     = 0;

var oH     = 0;

var oW     = 0;



function CObj(N,y,x){



 this.obj = document.createElement("span");

 this.obj.onclick = new Function("object["+N+"].GE1()");

 this.obj.onmousedown = new Function("return false;");

 this.obj.style.cursor = "pointer";

 this.obj.style.position = "absolute";

 this.img = document.createElement("img");

 this.img.style.position = "absolute";

 this.img.src = IMGSRC[N%nI].src;

 this.obj.appendChild(this.img);

 IMGBOX.appendChild(this.obj);



 this.object = new Array();

 this.x      = x;

 this.y      = y;

 this.N      = N;

 this.W      = 0;

 this.H      = 0;

 this.L      = 0;

 this.T      = 0;



 function CImg(Parent,y,x){

  this.Parent = Parent;



  this.obj = document.createElement("span");

  this.obj.style.position="absolute";

  this.obj.style.overflow="hidden";

  this.obj.style.cursor = "pointer";

  this.img = document.createElement("img");

  this.img.style.position = "absolute";

  this.img.src = IMGSRC[N%nI].src;

  this.obj.appendChild(this.img);

  this.Parent.obj.appendChild(this.obj);



  this.N   = Parent.N;

  this.x   = x;

  this.y   = y;

  this.W   = 0;

  this.H   = 0;

  this.L   = 0;

  this.T   = 0;

  this.dx  = 0;

  this.dy  = 0;

  this.px  = 0;

  this.py  = 0;

  this.dw  = 0;

  this.dh  = 0;

  this.pw  = 0;

  this.ph  = 0;

  this.ipx = 0;

  this.ipy = 0;

  this.idx = 0;

  this.idy = 0;



  this.GE2 = function (){

   with(this){

    px -= dx * dR;

    py -= dy * dR;

    pw += dw * dR;

    ph += dh * dR;

    ipx -= idx * dR;

    ipy -= idy * dR;



    with(obj.style){

     left   = Math.round(px);

     top    = Math.round(py);

     width  = Math.round(pw)+1;

     height = Math.round(ph)+1;

     if(dR==-1)if(pw<=W+1)obj.style.visibility="hidden";

    }



    with(img.style){

     left   = Math.round(ipx-oW);

     top    = Math.round(ipy-oH);

    }



    if(++xrun>=NX*NY*SP){

     xrun=0;

     run=false;

     if(dR==-1)Parent.obj.style.zIndex = 0;

     dR = -dR;

    }

   }

  }



  this.GE1 = function (N1,N2){

   with(this){

    if(dR==1){

     px  = L;

     py  = T;

     dx  = ((Parent.L + L) - (x * Parent.W)) / SP;

     dy  = ((Parent.T + T) - (y * Parent.H)) / SP;

     pw  = W;

     ph  = H;

     dw  = (Parent.W - W) / SP;

     dh  = (Parent.H - H) / SP;

     ipx = -L;

     ipy = -T;

     idx = ((x * Parent.W) - L) / SP;

     idy = ((y * Parent.H) - T) / SP;

    }

    obj.style.visibility="visible";

    if(img.height>document.body.offsetHeight)oH=(img.height-document.body.offsetHeight)/2; else oH = 0;

    if(img.width>document.body.offsetWidth/2)oW=(img.width-(document.body.offsetWidth/2))/2; else oW = 0;

    for(i=0;i<SP;i++) setTimeout("object["+N1+"].object["+N2+"].GE2()",16*i);

   }

  }



  this.DOOT = function (){

   with(this){

    W =  Parent.W  / NX;

    H =  Parent.H / NY;

    L =  x * W;

    T =  y * H;

   }

  }

 }



 var  k = 0;

 for(var i=0;i<NY;i++)

  for(var j=0;j<NX;j++)

   this.object[k++] = new CImg(this,i,j);



 this.GE1  = function (){

  with(this){

   if(!run){

    TXTBOX.innerHTML = "<div style='margin:2%'>"+TXTSRC[N%nI].innerHTML+"</div>";

    run = true;

    obj.style.zIndex = 1;

    for(var i=0;i<NX*NY;i++) setTimeout("object["+N+"].object["+i+"].GE1("+N+","+i+")",i*DELAY);

   }

  }

 }



 this.DOOT = function (){

  with(this){

   if(img.width<iW)iW=img.width;

   if(img.height<iH)iH=img.height;

   with(obj.style){

    W = width  = iW  / NX;

    H = height = iH / NY;

    L = left   = x * W;

    T = top    = y * H;

   }

   with(img.style){

    width  = W;

    height = H;

   }

   for(var i in object) object[i].DOOT();

  }

 }

}





onload = function() {

 IMGSRC = document.getElementById("imgsrc").getElementsByTagName("img");

 TXTSRC = document.getElementById("txtsrc").getElementsByTagName("div");

 IMGBOX = document.getElementById("imgbox");

 TXTBOX = document.getElementById("txtbox");

 CENTER = document.getElementById("center");

 iH = document.body.offsetHeight;

 iW = document.body.offsetWidth/2;

 nI = IMGSRC.length;

 var k = 0;

 for(var i=0;i<NY;i++){

  for(var j=0;j<NX;j++){

   object[k] = new CObj(k,i,j);

   object[k++].DOOT();

  }

 }

 IMGBOX.style.width  = iW;

 IMGBOX.style.height = iH;

 TXTBOX.style.width  = iW;

 TXTBOX.style.height = iH;

 TXTBOX.style.left   = iW;

 TXTBOX.style.visibility="visible";

 CENTER.style.left   = -iW;

 CENTER.style.top    = -iH/2;

}

//-->

</SCRIPT>

<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY>
<DIV style="LEFT: 50%; POSITION: absolute; TOP: 50%">
<DIV id=center style="POSITION: absolute">
<DIV id=imgbox 
style="LEFT: 0px; OVERFLOW: hidden; POSITION: absolute; TOP: 0px"></DIV>
<DIV id=txtbox 
style="FONT-SIZE: 0.8em; BACKGROUND: #333; VISIBILITY: hidden; OVERFLOW: hidden; COLOR: #fff; FONT-FAMILY: verdana; POSITION: absolute">
<DIV style="MARGIN: 2%">
<H2>IMGBOX</H2>Click the thumbnails on the left for a larger image. The 
description connected to the clicked image is displayed here.<BR><BR>Note: for 
performance reasons, images are not resized and must be all of the same size. 
</DIV></DIV></DIV></DIV>
<DIV id=imgsrc style="VISIBILITY: hidden"><IMG 
src="images/20065115756894.jpg"> <IMG 
src="images/20065115757878.jpg"> <IMG 
src="images/2006511581166.jpg"> <IMG 
src="images/2006511581185.jpg"> <IMG 
src="images/2006511581187.jpg"> <IMG 
src="images/2006511581588.jpg"> <IMG 
src="images/2006511581828.jpg"> <IMG 
src="images/2006511581951.jpg"> <IMG 
src="images/2006511581821.jpg"> </DIV>
<DIV id=txtsrc style="VISIBILITY: hidden">
<DIV>
<H2>the river</H2><BR>Awaken from my nap by the river </DIV>
<DIV>
<H2>transparency</H2><BR>Its transparency was hypnotizing. </DIV>
<DIV>
<H2>cold</H2><BR>Currents of cold water played with light. </DIV>
<DIV>
<H2>sank in</H2><BR>I threw a few nuts into the river. They floated for a while, 
then sank in. </DIV>
<DIV>
<H2>masked</H2><BR>A wide stepping stone masked the water's depth. </DIV>
<DIV>
<H2>a glimpse</H2><BR>Later on, I had a glimpse of the river's bed. </DIV>
<DIV>
<H2>forgotten</H2><BR>The wheelchair made a noise. Again, I had forgotten about 
my legs. </DIV>
<DIV>
<H2>floated</H2><BR>Still, I floated in oblivion of things too real. </DIV>
<DIV>
<H2>for me</H2><BR>I stared fixedly at the water's open arms. The stream was 
singing for me. </DIV></DIV><!-- crossbrowser images_loading_bar - Gerard Ferrandez - www.dhteumeuleu.com - Feb 2005 --><SPAN 
id=LB0 style="LEFT: 50%; POSITION: absolute; TOP: 50%"><SPAN 
style="FONT-SIZE: 10px; LEFT: -50px; COLOR: #ffffff; FONT-FAMILY: arial; POSITION: absolute; TOP: -18px">Loading...</SPAN> 
<SPAN 
style="FONT-SIZE: 1px; BACKGROUND: #333; LEFT: -50px; WIDTH: 100px; POSITION: absolute; TOP: -5px; HEIGHT: 10px"><SPAN 
id=LB1 
style="FONT-SIZE: 1px; BACKGROUND: #ffffff; LEFT: 0px; WIDTH: 0px; POSITION: absolute; TOP: 0px; HEIGHT: 10px"></SPAN></SPAN></SPAN>
<SCRIPT>m00=document.getElementById("imgsrc").getElementsByTagName("img");m01=m00.length;function images_loading_bar(){m02=0;for(i=0;i<m01;i++)m02+=(m00[i].complete)?1:0;document.getElementById("LB1").style.width=Math.round(m02/m01*100);if(m02==m01)setTimeout("document.getElementById('LB0').style.display='none'",128); else setTimeout("images_loading_bar()", 64);};images_loading_bar();</SCRIPT>
<!-- end of images_loading_bar code --></BODY></HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?