forked from jiangfengming/pull-to-refresh
/
material-colorful.html
84 lines (75 loc) · 2.66 KB
/
material-colorful.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link href="../dist/styles/material/style.css" rel="stylesheet">
<script src="../dist/styles/material/animates.js"></script>
<script src="../dist/pullToRefresh.js"></script>
<meta name="theme-color" content="#039be5">
<title>Pull to refresh - Material</title>
<style>
body {
margin: 0;
margin-top: 56px;
font-family: sans-serif;
background: #fafafa;
}
header {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 56px;
line-height: 56px;
font-size: 18px;
color: #fff;
padding: 0 16px;
background: #039be5;
z-index: 9999;
box-shadow: 0 2px 5px rgba(0,0,0,.26);
}
main {
background: #fff;
padding: 1em;
}
h1 {
font-size: 18px;
text-align: center;
padding-top: 8em;
}
</style>
</head>
<body>
<header>Header</header>
<div class="container pull-to-refresh-material">
<div class="pull-to-refresh-material__control">
<svg class="pull-to-refresh-material__icon" fill="#4285f4" width="24" height="24" viewBox="0 0 24 24">
<path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z" />
<path d="M0 0h24v24H0z" fill="none" />
</svg>
<svg class="pull-to-refresh-material__spinner" width="24" height="24" viewBox="25 25 50 50">
<circle class="pull-to-refresh-material__path pull-to-refresh-material__path--colorful" cx="50" cy="50" r="20" fill="none" stroke-width="4" stroke-miterlimit="10" />
</svg>
</div>
<main>
<h1>Pull down to refresh</h1>
<p>Pulling up should shrink the address bar in Chrome mobile and Safari mobile</p>
<p>1</p><p>2</p><p>3</p><p>4</p><p>5</p><p>6</p><p>7</p><p>8</p><p>9</p><p>10</p>
<p>11</p><p>12</p><p>13</p><p>14</p><p>15</p><p>16</p><p>17</p><p>18</p><p>19</p><p>20</p>
<p>21</p><p>22</p><p>23</p><p>24</p><p>25</p><p>26</p><p>27</p><p>28</p><p>29</p><p>30</p>
</main>
</div>
<script>
pullToRefresh({
container: document.querySelector('.container'),
animates: ptrAnimatesMaterial,
refresh() {
return new Promise(resolve => {
setTimeout(resolve, 6000)
})
}
})
</script>
</body>
</html>