-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
149 lines (136 loc) · 3.66 KB
/
demo.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta content="telephone=no,email=no" name="format-detection">
<title>demo page</title>
<link href="./pull-scale-banner.css" rel="stylesheet">
<style>
* {
padding: 0;
margin: 0;
}
.home-banner {
position: relative;
height: 100px;
padding-top: 8px;
box-sizing: border-box;
text-align: center;
}
.banner-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100px;
transform-origin: center top;
}
.top-bar {
position: relative;
display: flex;
height: 32px;
padding: 0 20px;
}
.top-bar-left {
display: block;
margin-top: 10px;
height: 12px;
width: 40px;
font-size: 0;
color: #fff;
}
.top-bar-left span {
display: inline-block;
height: 12px;
line-height: 12px;
margin-right: 5px;
vertical-align: bottom;
font-size: 12px;
}
.fa-angle-down {
vertical-align: bottom;
line-height: 12px;
font-size: 16px;
}
.top-bar-center {
display: flex;
width: 247px;
height: 32px;
margin-left: 12px;
padding: 6px 8px;
box-sizing: border-box;
background-color: #fff;
color: #ccc;
}
.fa-search {
display: block;
margin-right: 8px;
font-size: 20px;
}
.fa-search input {
width: 100%;
border: none;
outline: none;
font-size: 14px;
background-color: #fff;
}
.top-bar-right {
display: block;
width: 24px;
height: 24px;
margin-left: 12px;
margin-top: 4px;
}
.top-bar-right img {
display: block;
width: 24px;
height: 24px;
}
.main {
height: 1200px;
background-color: dodgerblue;
color: #fff;
text-align: center;
}
.main p {
padding-top: 50px;
}
</style>
</head>
<body>
<header class="home-banner">
<img class="banner-img" src="https://via.placeholder.com/375x100">
<div class="top-bar">
<div class="top-bar-left">
<span>北京</span>
<i class="fa fa-angle-down"></i>
</div>
<div class="top-bar-center">
<i class="fa fa-search"></i>
输入搜索品牌、商品
</div>
<div class="top-bar-right">
<img src="https://via.placeholder.com/24x24">
</div>
</div>
<div class="pull-message">下拉进行跳转</div>
</header>
<section class="main">
<p>从这里开始拖动</p>
</section>
<script src="./pull-scale-banner.js"></script>
<script type="text/javascript">
var pull = new pullScaleBanner({
drager: '.main',
scaler: '.banner-img'
});
pull.on('refresh', function () {
console.log('refresh begin');
setTimeout(function () {
pull.emit('success');
}, 100)
});
</script>
</body>
</html>