forked from Crise420WMT/crise420wmt.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list_iphoneTab.html
74 lines (67 loc) · 2.55 KB
/
list_iphoneTab.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>iPhone手机图片查看器</title>
<style>
* { padding: 0; margin: 0; }
li { list-style: none; }
body { background: #333; }
#iphone { width: 900px; height: 600px; background: url(image/iphoneTab_bg.jpg); position: absolute; top: 50%; left: 50%; margin: -300px 0 0 -450px; }
#wrap { width: 238px; height: 360px; position: absolute; top: 121px; left: 326px; overflow:hidden; }
#iphone ul { width: 960px; height: 361px; cursor: pointer; position: absolute; top: 0px; left: 0px; }
#iphone li { float: left; width:240px; height:360px; overflow:hidden; }
</style>
<script src="js/tween.js"></script>
<script>
window.onload=function(){
var oDiv=document.getElementById('wrap');
var oUl=oDiv.getElementsByTagName('ul')[0];
var aLi=oUl.children;
var iNow=0;
oUl.onmousedown=function(ev){
clearInterval(oUl.timer);
var oEvent=ev||event;
var disX=oEvent.clientX-oUl.offsetLeft;
var downX=oEvent.clientX;
document.onmousemove=function(ev) {
var oEvent = ev || event;
var l = oEvent.clientX - disX;
oUl.style.left = l + 'px';
};
document.onmouseup=function(ev){
document.onmousemove=null;
document.onmouseup=null;
var oEvent=ev||event;
var upX=oEvent.clientX;
if(Math.abs(downX-upX)>30){
if(downX>upX){
iNow++;
if(iNow>aLi.length-1)iNow=aLi.length-1;
}else{
iNow--;
if(iNow<0)iNow=0;
}
tween(oUl,{left:-aLi[0].offsetWidth*iNow});
}else{
tween(oUl,{left:-aLi[0].offsetWidth*iNow});
}
}
return false;
}
}
</script>
</head>
<body>
<div id="iphone">
<div id="wrap">
<ul>
<li style="background:url(image/iphoneTab_pic1.png);" title="crise"></li>
<li style="background:url(image/iphoneTab_pic2.png);" title="crise"></li>
<li style="background:url(image/iphoneTab_pic3.png);" title="crise"></li>
<li style="background:url(image/iphoneTab_pic4.png);" title="crise"></li>
</ul>
</div>
</div>
</body>
</html>