-
Notifications
You must be signed in to change notification settings - Fork 0
/
jiaxiang.html
203 lines (200 loc) · 8.04 KB
/
jiaxiang.html
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My HomeTown</title>
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
<link rel="stylesheet" type="text/css" href="css/default.css">
<style>
@import url(http://fonts.useso.com/css?family=Raleway:200,500,700,800);
@-webkit-keyframes animation{from{opacity:0; -webkit-transform:scale(1.2) rotateX(45deg);transform:scale(1.2) rotateX(45deg);} to{ }}
@-webkit-keyframes animation2{from{opacity:0; -webkit-transform:scale(1.2) rotateX(45deg);transform:scale(1.2) rotateX(45deg);} to{ }}
body {
background:#1c1c1c;
/*-webkit-perspective:1000px;*/
/*overflow:hidden;*/
}
.slider div p{color:#1c1c1c;position:absolute;bottom:-55px; font-family:Raleway; font-size:16px;}
.slider{
-webkit-animation:animation ease 1s;animation-delay:.8s;animation-fill-mode:backwards;
margin: 0 auto;
height:360px;
width:240px;
padding:40px;
top:100px;
perspective:1000px;
transition:ease-in-out .2s;
/*-webkit-transform:rotateX(45deg);
-webkit-transform-style:preserve-3d;
position:absolute;*/
}
/*.slider:active{ -webkit-transform:rotateZ(10deg);}*/
.slide img { text-align:center;width:100%; height:100%; -webkit-user-drag:none;user-drag:none;-moz-user-drag:none; border-radius:2px; }
.slide{
-webkit-user-select:none;
user-select:none;
-moz-user-select:none;
position:absolute;
height:280px;
width:240px;
box-shadow: 0px 10px 30px 0px rgba(0,0,0,0.3);
background:#fcfcfc;
-webkit-transform-style:preserve-3d;
transform-style:preserve-3d;
-moz-transform-style:preserve-3d;
text-align:center;
/*overflow:hidden;*/
border:12px white solid;
box-sizing:border-box;
border-bottom:55px white solid;
border-radius:5px;
}
.transition {
-webkit-transition: cubic-bezier(0,1.95,.49,.73) .4s ;
-moz-transition: cubic-bezier(0,1.95,.49,.73) .4s ;
transition: cubic-bezier(0,1.95,.49,.73) .4s ;
}
</style>
<!--[if IE]>
<script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
<![endif]-->
</head>
<body>
<div class="htmleaf-container">
<div class="htmleaf-content">
<div class="slider">
<div class="slide" ><img src="img/1.jpg" /><p>rutrum tellus a tempus :)</p></div>
<div class="slide"><img src="img/3.jpg" /><p>litora torquent per conubia</p></div>
<div class="slide"><img src="img/2.jpg" /><p>sed consectetur faucibus</p></div>
<div class="slide" ><img src="img/4.jpg" /><p>eleifend tempus justo</p></div>
</div>
</div>
<div style="text-align:center;clear:both">
<script src="/gg_bd_ad_720x90.js" type="text/javascript"></script>
<script src="/follow.js" type="text/javascript"></script>
</div>
</div>
<script src='js/stopExecutionOnTimeout.js?t=1'></script>
<script>
window.addEventListener('load', onWndLoad, false);
function onWndLoad() {
var slider = document.querySelector('.slider');
var sliders = slider.children;
var initX = null;
var transX = 0;
var rotZ = 0;
var transY = 0;
var curSlide = null;
var Z_DIS = 50;
var Y_DIS = 10;
var TRANS_DUR = 0.4;
var images = document.querySelectorAll('img');
for (var i = 0; i < images.length; i++) {
if (window.CP.shouldStopExecution(1)) {
break;
}
images[i].onmousemove = function (e) {
e.preventDefault();
};
images[i].ondragstart = function (e) {
return false;
};
}
window.CP.exitedLoop(1);
function init() {
var z = 0, y = 0;
for (var i = sliders.length - 1; i >= 0; i--) {
if (window.CP.shouldStopExecution(2)) {
break;
}
sliders[i].style.transform = 'translateZ(' + z + 'px) translateY(' + y + 'px)';
z -= Z_DIS;
y += Y_DIS;
}
window.CP.exitedLoop(2);
attachEvents(sliders[sliders.length - 1]);
}
function attachEvents(elem) {
curSlide = elem;
curSlide.addEventListener('mousedown', slideMouseDown, false);
curSlide.addEventListener('touchstart', slideMouseDown, false);
}
init();
function slideMouseDown(e) {
if (e.touches) {
initX = e.touches[0].clientX;
} else {
initX = e.pageX;
}
document.addEventListener('mousemove', slideMouseMove, false);
document.addEventListener('touchmove', slideMouseMove, false);
document.addEventListener('mouseup', slideMouseUp, false);
document.addEventListener('touchend', slideMouseUp, false);
}
var prevSlide = null;
function slideMouseMove(e) {
var mouseX;
if (e.touches) {
mouseX = e.touches[0].clientX;
} else {
mouseX = e.pageX;
}
transX += mouseX - initX;
rotZ = transX / 20;
transY = -Math.abs(transX / 15);
curSlide.style.transition = 'none';
curSlide.style.webkitTransform = 'translateX(' + transX + 'px)' + ' rotateZ(' + rotZ + 'deg)' + ' translateY(' + transY + 'px)';
curSlide.style.transform = 'translateX(' + transX + 'px)' + ' rotateZ(' + rotZ + 'deg)' + ' translateY(' + transY + 'px)';
var j = 1;
for (var i = sliders.length - 2; i >= 0; i--) {
if (window.CP.shouldStopExecution(3)) {
break;
}
sliders[i].style.webkitTransform = 'translateX(' + transX / (2 * j) + 'px)' + ' rotateZ(' + rotZ / (2 * j) + 'deg)' + ' translateY(' + Y_DIS * j + 'px)' + ' translateZ(' + -Z_DIS * j + 'px)';
sliders[i].style.transform = 'translateX(' + transX / (2 * j) + 'px)' + ' rotateZ(' + rotZ / (2 * j) + 'deg)' + ' translateY(' + Y_DIS * j + 'px)' + ' translateZ(' + -Z_DIS * j + 'px)';
sliders[i].style.transition = 'none';
j++;
}
window.CP.exitedLoop(3);
initX = mouseX;
e.preventDefault();
if (Math.abs(transX) >= curSlide.offsetWidth - 30) {
document.removeEventListener('mousemove', slideMouseMove, false);
document.removeEventListener('touchmove', slideMouseMove, false);
curSlide.style.transition = 'ease 0.2s';
curSlide.style.opacity = 0;
prevSlide = curSlide;
attachEvents(sliders[sliders.length - 2]);
slideMouseUp();
setTimeout(function () {
slider.insertBefore(prevSlide, slider.firstChild);
prevSlide.style.transition = 'none';
prevSlide.style.opacity = '1';
slideMouseUp();
}, 201);
return;
}
}
function slideMouseUp() {
transX = 0;
rotZ = 0;
transY = 0;
curSlide.style.transition = 'cubic-bezier(0,1.95,.49,.73) ' + TRANS_DUR + 's';
curSlide.style.webkitTransform = 'translateX(' + transX + 'px)' + 'rotateZ(' + rotZ + 'deg)' + ' translateY(' + transY + 'px)';
curSlide.style.transform = 'translateX(' + transX + 'px)' + 'rotateZ(' + rotZ + 'deg)' + ' translateY(' + transY + 'px)';
var j = 1;
for (var i = sliders.length - 2; i >= 0; i--) {
sliders[i].style.transition = 'cubic-bezier(0,1.95,.49,.73) ' + TRANS_DUR / (j + 0.9) + 's';
sliders[i].style.webkitTransform = 'translateX(' + transX + 'px)' + 'rotateZ(' + rotZ + 'deg)' + ' translateY(' + Y_DIS * j + 'px)' + ' translateZ(' + -Z_DIS * j + 'px)';
sliders[i].style.transform = 'translateX(' + transX + 'px)' + 'rotateZ(' + rotZ + 'deg)' + ' translateY(' + Y_DIS * j + 'px)' + ' translateZ(' + -Z_DIS * j + 'px)';
j++;
}
document.removeEventListener('mousemove', slideMouseMove, false);
document.removeEventListener('touchmove', slideMouseMove, false);
}
}
</script>
</body>
</html>