Skip to content

Commit f84e08a

Browse files
committed
Update lang.html
1 parent efafecf commit f84e08a

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

homepage/lang.html

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
color: #d4d5d7;
2525
font-family: 'Inter', system-ui, sans-serif;
2626
text-align: center;
27+
scroll-snap-type: y proximity;
2728
}
2829

2930
body {
@@ -35,21 +36,46 @@
3536
padding: 0 20px;
3637
}
3738

39+
.top-snap-marker {
40+
scroll-snap-align: start;
41+
}
42+
3843
.logo {
3944
width: 70px;
4045
border-radius: 22.5%;
4146
border: 1px solid rgba(255,255,255,.1);
4247
margin: 0 auto;
4348
margin-bottom: 24px;
4449
margin-top: 50px;
50+
position: relative;
51+
z-index: 1000;
4552
}
4653

4754
.title {
4855
font-size: 19px;
4956
margin-bottom: 24px;
57+
padding-top: 24px;
5058
margin-top: 0;
51-
position: relative;
5259
text-align: center;
60+
position: sticky;
61+
z-index: 999;
62+
top: 0;
63+
scroll-snap-align: start;
64+
}
65+
66+
.title::before {
67+
content: '';
68+
position: fixed;
69+
left: 0;
70+
top: 0;
71+
right: 0;
72+
background: linear-gradient(180deg, #1a1c24 calc(100% - 23px), #1a1c2400);
73+
height: calc(24px + 23px + 24px + 12px);
74+
z-index: -1;
75+
}
76+
77+
.center {
78+
scroll-snap-align: center;
5379
}
5480

5581
.button {
@@ -139,7 +165,7 @@
139165
<body ontouchstart="">
140166
<img class="logo" src="/icons/iphone-app-180.png" width="80" draggable="false" alt="Codeit">
141167
<p class="title">Supported languages</p>
142-
<div class="languages" style="display: inline-block;line-height: 1.5;text-align: left;width: max-content;margin: auto;">Just a sec...</div>
168+
<div class="languages center" style="display: inline-block;line-height: 1.5;text-align: left;width: max-content;margin: auto;">Just a sec...</div>
143169
<p style="margin-top: 50px;margin-bottom: 50px;">
144170
<a href="/" style="color: inherit;">- ❤️ Codeit team</a>
145171
</p>
@@ -157,6 +183,21 @@
157183

158184
document.querySelector('.languages').innerHTML = out;
159185

186+
187+
// scroll listener
188+
189+
const scrollEl = document.documentElement,
190+
scrollEnd = scrollToEl.offsetTop,
191+
logo = document.querySelector('.logo');
192+
193+
window.addEventListener('scroll', () => {
194+
195+
const scrollPos = scrollEl.scrollTop;
196+
const opacityPercent = 1 - (scrollPos / scrollEnd);
197+
logo.style.opacity = opacityPercent;
198+
199+
});
200+
160201
</script>
161202

162203
</body>

0 commit comments

Comments
 (0)