-
Notifications
You must be signed in to change notification settings - Fork 0
/
PracticeAlratv.html
90 lines (81 loc) · 1.74 KB
/
PracticeAlratv.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css" media="all">
:root {
color: #333;
}
body {
margin: 0;
height: 200vh;
}
#nav {
height: 40vh;
background: #0bbc7dfc;
}
#form {
width: 300px;
height: 400px;
background: #18c5d2fc;
margin: 0 auto;
transform: translateY(-100px);
border-radius: 10px;
}
#target {
color: #555;
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #16df5f;
background: #fff;
border-top: 1px solid #ddd;
color: #040851;
color: #333;
box-shadow: rgba(14, 30, 37, 0.12) 0px 2px 4px 0px, rgba(14, 30, 37, 0.32) 0px 2px 16px 0px;
padding: 6px 1em;
transition: transform 0.2s;
display: flex;
justify-content: space-between;
}
h3 {
margin: 0;
}
</style>
<title>practice</title>
</head>
<body>
<nav id="nav">
</nav>
<article id="form">
</article>
<div id="target">
<div>
<h3>Target</h3>
<h3>1000</h3>
</div>
<div>
<h3>Acheived</h3>
<h3>999</h3>
</div>
</div>
<script type="text/javascript" charset="utf-8">
const bottom_bar = document.getElementById('target')
let yy = 0
window.addEventListener('scroll', e => {
const y = window.scrollY
if(y > yy) {
bottom_bar.style.transform = 'translateY(100px)'
yy = y
}
else if(y < yy){
bottom_bar.style.transform = 'translateY(0)';
yy = y
}
console.log(y)
})
</script>
</body>
</html>