-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
94 lines (93 loc) · 2.33 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1,width=device-width, height=device-height"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<style>
body {
padding: 0px;
margin: 0px;
}
.scrollable {
-webkit-overflow-scrolling: touch;
position: absolute;
top: 60px;
bottom: 0px;
height: auto;
width: 100%;
background-color: red;
overflow-y: auto;
}
header {
line-height: 60px;
font-size: 24px;
text-align: center;
background-color: #eee;
position: fixed;
width: 100%;
z-index: 100;
}
.content {
height: 800px;
}
</style>
</head>
<body>
<header>
头部
</header>
<div class="scrollable">
<div class="content">
scroll me
<div class="tmp">1</div>
<div class="tmp">1</div>
<div class="tmp">1</div>
<div class="tmp">1</div>
<div class="tmp">1</div>
<div class="tmp">1</div>
<div class="tmp">1</div>
<div class="tmp">1</div>
<div class="tmp">1</div>
<div class="tmp">1</div>
<div class="tmp">1</div>
</div>
</div>
<script src='build/build.js'></script>
<script>
document.addEventListener('touchmove', function(e) {
e.preventDefault();
})
var el = document.querySelector('.scrollable');
var content = document.querySelector('.content');
var sy = 0;
el.addEventListener('touchstart', function(e) {
sy = e.pageY;
if (el.scrollTop == 0) {
el.scrollTop = 1;
}
})
el.addEventListener('touchmove', function(e) {
e.stopPropagation();
//console.log(e.currentTarget);
})
el.addEventListener('scroll', function(e) {
//console.log(e.currentTarget);
});
el.addEventListener('touchmove', function(e) {
if (e.pageY -sy < 0 && el.scrollHeight <= el.scrollTop + el.offsetHeight) {
e.preventDefault();
}
})
var tap = require('tap-event');
el.addEventListener('touchstart', tap(function(e) {
console.log('tap');
}))
</script>
<!--
<script src="http://192.168.199.141:8081/target/target-script.js"></script>
-->
</body>
</html>