1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
| <!--jQueryを使用-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<style>
/*perspective 奥行きの設定*/
#contents{
-webkit-perspective: 200;
width:300px;
height:300px;
position:relative;
left:330px;
}
#contents img{
width:300px;
height:300px;
border:solid 1px #000;
opacity:0.5;
/*画像を同じ位置に重ねる*/
position: absolute;
top: 0px;
left: 0px;
}
/*画像それぞれの奥行き設定*/
#img00{
-webkit-transform:
translate3d(-150px, 0px, 0px)
rotate3d(0, 1, 0, 90deg)
translate3d(150px, 0px, 0px);
}
#img01{
-webkit-transform:
translate3d(150px, 0px, 0px)
rotate3d(0, 1, 0, -90deg)
translate3d(-150px, 0px, 0px);
}
#img02{
-webkit-transform:
translate3d(0px, -150px, 0px)
rotate3d(1, 0, 0, -90deg)
translate3d(0px, 150px, 0px);
}
#img03{
-webkit-transform:
translate3d(0px, 150px, 0px)
rotate3d(1, 0, 0, 90deg)
translate3d(0px, -150px, 0px);
}
#img04{
-webkit-transform:
translate3d(0px ,0px ,-300px)
}
</style>
<script>
// ページの読み込みが終了したら実行
window.onload = function(){
// buttonのidを読み込んで関数に代入
var myPush = document.getElementById("myPush");
// buttonがclickされたら実行
myPush.addEventListener('click',function(){
for (i = 0; i < 5; i++){
$(function(){
// インデックスeq()でimgに順番にidを付加(attr)
$("#contents img:eq("+i+")").attr('id','img0'+i);
})
}
},false) //trueだとイベント発生の順番を越えて優先で実行
}
</script>
<div id="contents">
<ul>
<li><img src="images/chrome.png" width="100" height="100" alt=""></li>
<li><img src="images/firefox.png" width="100" height="100" alt=""></li>
<li><img src="images/ie.png" width="100" height="100" alt=""></li>
<li><img src="images/opera.png" width="100" height="100" alt="" ></li>
<li><img src="images/safari.png" width="100" height="100" alt="" ></li>
</ul>
</div>
<p> <br><br><br></p>
<button id="myPush">push 3D</button> |