分享
 
 
 

将图片图片固定在页面左上角

王朝other·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

<!-- website:http://www.knowsky.com -->

<!-- bbs:http://bbs.knowsky.com -->

<!-- 完整的HTML代码如下 -->

<html>

<head>

<title>类似于Flash制作的一个图片展示效果</title>

<meta name="Author" content="http://www.knowsky.com">

<meta http-equiv="imagetoolbar" content="no">

<style type="text/css">

body {cursor:crosshair;margin:0; padding:0; position:absolute; overflow:hidden; background:#222; left:0; top:0; width:100%; height:100%;zIndex:-2;}

</style>

<script type="text/javascript"><!--

// ====================================================

// http://www.knowsky.com

// DOM version : 2005.4

// ====================================================

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>

</head>

<body>

<div style="position:absolute;left:50%;top:50%;"><div id="center" style="position:absolute;">

<div id="imgbox" style="position:absolute;left:0;top:0;overflow:hidden;"></div>

<div id="txtbox" style="position:absolute;visibility:hidden;overflow:hidden;background:#333;color:#FFF;font-family:verdana;font-size:0.8em;">

<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="http://www.knowsky.com/upfiles/20050411/BS9097.jpg">

<img src="http://www.knowsky.com/upfiles/20050411/BS9092.jpg">

<img src="http://www.knowsky.com/upfiles/20050411/BS9084.jpg">

<img src="http://www.knowsky.com/upfiles/20050411/BS9064.jpg">

<img src="http://www.knowsky.com/upfiles/20050411/BS9050.jpg">

<img src="http://www.knowsky.com/upfiles/20050411/BS9070.jpg">

<img src="http://www.knowsky.com/upfiles/20050411/BS9079.jpg">

<img src="http://www.knowsky.com/upfiles/20050411/BS9068.jpg">

<img src="http://www.knowsky.com/upfiles/20050411/BS9039.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="position:absolute;left:50%;top:50%;"><span style="position:absolute;font-family:arial;font-size:10px;color:#FFFFFF;left:-50;top:-18">Loading...</span>

<span style="position:absolute;left:-50;top:-5;font-size:1px;width:100;height:10px;background:#333"><span id=LB1 style="position:absolute;left:0;top:0;font-size:1px;width:0;height:10px;background:#FFFFFF"></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>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有