2018-11-01

照片墙


画廊.gif

html代码

<!DOCTYPE html>
<html>
<head>
<title>照片墙</title>
<link rel="stylesheet" type="text/css" href="css.css">
<meta charset="utf-8">
</head>
<body onselectstart="return false;">
<div id="head">开始</div>
<div class="container" id="container">
<img src="img/01.jpg" id="img1">
<img src="img/02.jpg" id="img2">
<img src="img/03.jpg" id="img3">
<img src="img/04.jpg" id="img4">
<img src="img/05.jpg" id="img5">
<img src="img/06.jpg" id="img6">
<img src="img/07.jpg" id="img7">
<img src="img/08.jpg" id="img8">
</div>
<script type="text/javascript" src="js.js"></script>
</body>
</html>

css代码
*{
padding: 0;
margin: 0;
background: #eee;
}

head{

display: block;
height: 50px;
width: 70px;
border-style:outset;
line-height: 50px;
font-size: 20px;
margin: 0 auto;
text-align: center;
cursor: pointer;
border-color: #e0e0e0;

}
.container{
width: 1400px;
height: 900px;
margin: 60px auto;
position: relative;
}
.container img{
position: absolute;
width: 533px;
height: 300px;
text-align: center;
background-size: 100% 100%;
padding: 10px 10px 15px;
border: 1px solid #ddd;
}

img1{

top: 360px;
left: 500px;
transform: rotate(320deg);
z-index: 1;

}

img2{

top: 50px;
left: 400px;
transform: rotate(20deg);
z-index: 1;

}

img3{

top: 340px;
left: 700px;
transform: rotate(14deg);
z-index: 1;

}

img4{

top: 370px;
left: 50px;
transform: rotate(340deg);
z-index: 1;

}

img5{

top: 50px;
left: 900px;
transform: rotate(10deg);
z-index: 1;

}

img6{

top: 80px;
left: 20px;
transform: rotate(15deg);
z-index: 1;

}

img7{

top: 350px;
left: 900px;
transform: rotate(351deg);
z-index: 1;

}

img8{

top: 50px;
left: 200px;
transform: rotate(20deg);
z-index: 1;

}

js代码
function byId(id) {
return typeof(id) === "string"?document.getElementById(id):id; //判断id是否为字符串
}//封装一个代替getElementById()的方法

var btn = byId('head');
var container = byId('container');
var pits = byId('container').getElementsByTagName("img");
var len = pits.length;
var time = 2000;

var oldTop = new Array(8);
var oldLeft = new Array(8);
function stop(){

}
btn.onclick = function(){
oldLeft[0] = pits[0].offsetLeft;
oldTop[0] = pits[0].offsetTop;
oldLeft[1] = pits[1].offsetLeft;
oldTop[1] = pits[1].offsetTop;
oldLeft[2] = pits[2].offsetLeft;
oldTop[2] = pits[2].offsetTop;
oldLeft[3] = pits[3].offsetLeft;
oldTop[3] = pits[3].offsetTop;
oldLeft[4] = pits[4].offsetLeft;
oldTop[4] = pits[4].offsetTop;
oldLeft[5] = pits[5].offsetLeft;
oldTop[5] = pits[5].offsetTop;
oldLeft[6] = pits[6].offsetLeft;
oldTop[6] = pits[6].offsetTop;
oldLeft[7] = pits[7].offsetLeft;
oldTop[7] = pits[7].offsetTop;
function up0(){
pits[0].style.left = 450+'px';
pits[0].style.top = 200+'px';
pits[0].style.transition = 1+'s';
pits[0].style.transform = "rotate(0deg)";
pits[0].style.zIndex = 2;
pits[0].style.transform="scale(1.2)";
pits[0].style.boxShadow = "10px 10px 15px #ccc";

        }
        setTimeout(up0,0)

        function down0(){
            pits[0].style.left = oldLeft[0]+'px';
            pits[0].style.top = oldTop[0]+'px';
            pits[0].style.transition = 2+'s';
            pits[0].style.zIndex = 1;
            pits[0].style.transform="scale(1)";
            pits[0].style.transform = "rotate(320deg)";
            pits[0].style.boxShadow = " 0 0 0 #e0e0e0";
            
        }
        setTimeout(down0,1500);



        function up1(){
            pits[1].style.left = 450+'px';
            pits[1].style.top = 200+'px';
            pits[1].style.transition = 1+'s';
            pits[1].style.transform = "rotate(0deg)";
            pits[1].style.zIndex = 2;
            pits[1].style.transform="scale(1.2)";
            pits[1].style.boxShadow = "10px 10px 15px #ccc";
            

        }
        setTimeout(up1,2500)

        function down1(){
            pits[1].style.left = oldLeft[1]+'px';
            pits[1].style.top = oldTop[1]+'px';
            pits[1].style.transition = 2+'s';
            pits[1].style.zIndex = 1;
            pits[1].style.transform="scale(1)";
            pits[1].style.transform = "rotate(20deg)";
            pits[1].style.boxShadow = " 0 0 0 #e0e0e0";
            
        }
        setTimeout(down1,4000);

        function up2(){
            pits[2].style.left = 450+'px';
            pits[2].style.top = 200+'px';
            pits[2].style.transition = 1+'s';
            pits[2].style.transform = "rotate(0deg)";
            pits[2].style.zIndex = 2;
            pits[2].style.transform="scale(1.2)";
            pits[2].style.boxShadow = "10px 10px 15px #ccc";
            

        }
        setTimeout(up2,5000)

        function down2(){
            pits[2].style.left = oldLeft[2]+'px';
            pits[2].style.top = oldTop[2]+'px';
            pits[2].style.transition = 2+'s';
            pits[2].style.zIndex = 1;
            pits[2].style.transform="scale(1)";
            pits[2].style.transform = "rotate(14deg)";
            pits[2].style.boxShadow = " 0 0 0 #e0e0e0";
            
        }
        setTimeout(down2,6500);



        function up3(){
            pits[3].style.left = 450+'px';
            pits[3].style.top = 200+'px';
            pits[3].style.transition = 1+'s';
            pits[3].style.transform = "rotate(0deg)";
            pits[3].style.zIndex = 2;
            pits[3].style.transform="scale(1.2)";
            pits[3].style.boxShadow = "10px 10px 15px #ccc";
            

        }
        setTimeout(up3,7500)

        function down3(){
            pits[3].style.left = oldLeft[3]+'px';
            pits[3].style.top = oldTop[3]+'px';
            pits[3].style.transition = 2+'s';
            pits[3].style.zIndex = 1;
            pits[3].style.transform="scale(1)";
            pits[3].style.transform = "rotate(340deg)";
            pits[3].style.boxShadow = " 0 0 0 #e0e0e0";
            
        }
        setTimeout(down3,9000);




        function up4(){
            pits[4].style.left = 450+'px';
            pits[4].style.top = 200+'px';
            pits[4].style.transition = 1+'s';
            pits[4].style.transform = "rotate(0deg)";
            pits[4].style.zIndex = 2;
            pits[4].style.transform="scale(1.2)";
            pits[4].style.boxShadow = "10px 10px 15px #ccc";
            

        }
        setTimeout(up4,10000)

        function down4(){
            pits[4].style.left = oldLeft[4]+'px';
            pits[4].style.top = oldTop[4]+'px';
            pits[4].style.transition = 2+'s';
            pits[4].style.zIndex = 1;
            pits[4].style.transform="scale(1)";
            pits[4].style.transform = "rotate(10deg)";
            pits[4].style.boxShadow = " 0 0 0 #e0e0e0";
            
        }
        setTimeout(down4,11500);




        function up5(){
            pits[5].style.left = 450+'px';
            pits[5].style.top = 200+'px';
            pits[5].style.transition = 1+'s';
            pits[5].style.transform = "rotate(0deg)";
            pits[5].style.zIndex = 2;
            pits[5].style.transform="scale(1.2)";
            pits[5].style.boxShadow = "10px 10px 15px #ccc";
            

        }
        setTimeout(up5,12500)

        function down5(){
            pits[5].style.left = oldLeft[5]+'px';
            pits[5].style.top = oldTop[5]+'px';
            pits[5].style.transition = 2+'s';
            pits[5].style.zIndex = 1;
            pits[5].style.transform="scale(1)";
            pits[5].style.transform = "rotate(15deg)";
            pits[5].style.boxShadow = " 0 0 0 #e0e0e0";
            
        }
        setTimeout(down5,14000);




        function up6(){
            pits[6].style.left = 450+'px';
            pits[6].style.top = 200+'px';
            pits[6].style.transition = 1+'s';
            pits[6].style.transform = "rotate(0deg)";
            pits[6].style.zIndex = 2;
            pits[6].style.transform="scale(1.2)";
            pits[6].style.boxShadow = "10px 10px 15px #ccc";
            

        }
        setTimeout(up6,15000)

        function down6(){
            pits[6].style.left = oldLeft[6]+'px';
            pits[6].style.top = oldTop[6]+'px';
            pits[6].style.transition = 2+'s';
            pits[6].style.zIndex = 1;
            pits[6].style.transform="scale(1)";
            pits[6].style.transform = "rotate(351deg)";
            pits[6].style.boxShadow = " 0 0 0 #e0e0e0";
            
        }
        setTimeout(down6,16500);



        function up7(){
            pits[7].style.left = 450+'px';
            pits[7].style.top = 200+'px';
            pits[7].style.transition = 1+'s';
            pits[7].style.transform = "rotate(0deg)";
            pits[7].style.zIndex = 2;
            pits[7].style.transform="scale(1.2)";
            pits[7].style.boxShadow = "10px 10px 15px #ccc";
            

        }
        setTimeout(up7,17500)

        function down7(){
            pits[7].style.left = oldLeft[7]+'px';
            pits[7].style.top = oldTop[7]+'px';
            pits[7].style.transition = 2+'s';
            pits[7].style.zIndex = 1;
            pits[7].style.transform="scale(1)";
            pits[7].style.transform = "rotate(20deg)";
            pits[7].style.boxShadow = " 0 0 0 #e0e0e0";
            
        }
        setTimeout(down7,19000);

}

var img1 = byId("img1");
var img2 = byId("img2");
var img3 = byId("img3");
var img4 = byId("img4");
var img5 = byId("img5");
var img6 = byId("img6");
var img7 = byId("img7");
var img8 = byId("img8");

img1.onmouseover = function(){
img1.style.transition = 1+'s';
img1.style.transform = "rotate(0deg)";
img1.style.zIndex = 2;
img1.style.transform="scale(1.2)";
img1.style.boxShadow = "10px 10px 15px #ccc";
}
img1.onmouseout = function(){
img1.style.left = oldLeft[0]+'px';
img1.style.top = oldTop[0]+'px';
img1.style.transition = 1+'s';
img1.style.zIndex = 1;
img1.style.transform="scale(1)";
img1.style.transform = "rotate(320deg)";
img1.style.boxShadow = " 0 0 0 #e0e0e0";
}

img2.onmouseover = function(){
img2.style.transition = 1+'s';
img2.style.transform = "rotate(0deg)";
img2.style.zIndex = 2;
img2.style.transform="scale(1.2)";
img2.style.boxShadow = "10px 10px 15px #ccc";
}
img2.onmouseout = function(){
img2.style.left = oldLeft[1]+'px';
img2.style.top = oldTop[1]+'px';
img2.style.transition = 1+'s';
img2.style.zIndex = 1;
img2.style.transform="scale(1)";
img2.style.transform = "rotate(20deg)";
img2.style.boxShadow = " 0 0 0 #e0e0e0";
}

img3.onmouseover = function(){
img3.style.transition = 1+'s';
img3.style.transform = "rotate(0deg)";
img3.style.zIndex = 2;
img3.style.transform="scale(1.2)";
img3.style.boxShadow = "10px 10px 15px #ccc";
}
img3.onmouseout = function(){
img3.style.left = oldLeft[2]+'px';
img3.style.top = oldTop[2]+'px';
img3.style.transition = 1+'s';
img3.style.zIndex = 1;
img3.style.transform="scale(1)";
img3.style.transform = "rotate(14deg)";
img3.style.boxShadow = " 0 0 0 #e0e0e0";
}

img4.onmouseover = function(){
img4.style.transition = 1+'s';
img4.style.transform = "rotate(0deg)";
img4.style.zIndex = 2;
img4.style.transform="scale(1.2)";
img4.style.boxShadow = "10px 10px 15px #ccc";
}
img4.onmouseout = function(){
img4.style.left = oldLeft[3]+'px';
img4.style.top = oldTop[3]+'px';
img4.style.transition = 1+'s';
img4.style.zIndex = 1;
img4.style.transform="scale(1)";
img4.style.transform = "rotate(340deg)";
img4.style.boxShadow = " 0 0 0 #e0e0e0";
}

img5.onmouseover = function(){
img5.style.transition = 1+'s';
img5.style.transform = "rotate(0deg)";
img5.style.zIndex = 2;
img5.style.transform="scale(1.2)";
img5.style.boxShadow = "10px 10px 15px #ccc";
}
img5.onmouseout = function(){
img5.style.left = oldLeft[4]+'px';
img5.style.top = oldTop[4]+'px';
img5.style.transition = 1+'s';
img5.style.zIndex = 1;
img5.style.transform="scale(1)";
img5.style.transform = "rotate(10deg)";
img5.style.boxShadow = " 0 0 0 #e0e0e0";
}

img6.onmouseover = function(){
img6.style.transition = 1+'s';
img6.style.transform = "rotate(0deg)";
img6.style.zIndex = 2;
img6.style.transform="scale(1.2)";
img6.style.boxShadow = "10px 10px 15px #ccc";
}
img6.onmouseout = function(){
img6.style.left = oldLeft[5]+'px';
img6.style.top = oldTop[5]+'px';
img6.style.transition = 1+'s';
img6.style.zIndex = 1;
img6.style.transform="scale(1)";
img6.style.transform = "rotate(15deg)";
img6.style.boxShadow = " 0 0 0 #e0e0e0";
}

img7.onmouseover = function(){
img7.style.transition = 1+'s';
img7.style.transform = "rotate(0deg)";
img7.style.zIndex = 2;
img7.style.transform="scale(1.2)";
img7.style.boxShadow = "10px 10px 15px #ccc";
}
img7.onmouseout = function(){
img7.style.left = oldLeft[6]+'px';
img7.style.top = oldTop[6]+'px';
img7.style.transition = 1+'s';
img7.style.zIndex = 1;
img7.style.transform="scale(1)";
img7.style.transform = "rotate(351deg)";
img7.style.boxShadow = " 0 0 0 #e0e0e0";
}

img8.onmouseover = function(){
img8.style.transition = 1+'s';
img8.style.transform = "rotate(0deg)";
img8.style.zIndex = 2;
img8.style.transform="scale(1.2)";
img8.style.boxShadow = "10px 10px 15px #ccc";
}
img8.onmouseout = function(){
img8.style.left = oldLeft[7]+'px';
img8.style.top = oldTop[7]+'px';
img8.style.transition = 1+'s';
img8.style.zIndex = 1;
img8.style.transform="scale(1)";
img8.style.transform = "rotate(20deg)";
img8.style.boxShadow = " 0 0 0 #e0e0e0";
}

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 216,287评论 6 498
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,346评论 3 392
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 162,277评论 0 353
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,132评论 1 292
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,147评论 6 388
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,106评论 1 295
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,019评论 3 417
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,862评论 0 274
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,301评论 1 310
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,521评论 2 332
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,682评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,405评论 5 343
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,996评论 3 325
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,651评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,803评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,674评论 2 368
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,563评论 2 352

推荐阅读更多精彩内容

  • 2018年11月1日 姓名 :曹静杰 企业名称 : 辽宁辽阳丛迪服装有限公司 组别 388期 反省1组 【日精进打...
    eddd166e28ad阅读 274评论 0 0
  • 排错指南 - Pod 本文档介绍 Pod 的异常状态,可能原因和解决办法。 排查 Pod 异常的常用命令如下: 查...
    小孩子的童话2014阅读 6,974评论 0 2
  • 前段时间上线了一批文,我几乎没有进行任何景物描写和人物外貌描写,一直在内心世界沉沦。现在觉得要关注一下除我以外的...
    CranesLand阅读 110评论 0 1
  • 离开了喧闹的城市 不经意 走进了湛蓝的天空 深沉任性的风水 撩起我激越的心扉 让目光远行 镜头全是迷人的梦景 在平...
    学会给予阅读 1,165评论 2 4