|
24 | 24 | color: #d4d5d7; |
25 | 25 | font-family: 'Inter', system-ui, sans-serif; |
26 | 26 | text-align: center; |
| 27 | + scroll-snap-type: y proximity; |
27 | 28 | } |
28 | 29 |
|
29 | 30 | body { |
|
35 | 36 | padding: 0 20px; |
36 | 37 | } |
37 | 38 |
|
| 39 | + .top-snap-marker { |
| 40 | + scroll-snap-align: start; |
| 41 | + } |
| 42 | + |
38 | 43 | .logo { |
39 | 44 | width: 70px; |
40 | 45 | border-radius: 22.5%; |
41 | 46 | border: 1px solid rgba(255,255,255,.1); |
42 | 47 | margin: 0 auto; |
43 | 48 | margin-bottom: 24px; |
44 | 49 | margin-top: 50px; |
| 50 | + position: relative; |
| 51 | + z-index: 1000; |
45 | 52 | } |
46 | 53 |
|
47 | 54 | .title { |
48 | 55 | font-size: 19px; |
49 | 56 | margin-bottom: 24px; |
| 57 | + padding-top: 24px; |
50 | 58 | margin-top: 0; |
51 | | - position: relative; |
52 | 59 | 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; |
53 | 79 | } |
54 | 80 |
|
55 | 81 | .button { |
|
139 | 165 | <body ontouchstart=""> |
140 | 166 | <img class="logo" src="/icons/iphone-app-180.png" width="80" draggable="false" alt="Codeit"> |
141 | 167 | <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> |
143 | 169 | <p style="margin-top: 50px;margin-bottom: 50px;"> |
144 | 170 | <a href="/" style="color: inherit;">- ❤️ Codeit team</a> |
145 | 171 | </p> |
|
157 | 183 |
|
158 | 184 | document.querySelector('.languages').innerHTML = out; |
159 | 185 |
|
| 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 | + |
160 | 201 | </script> |
161 | 202 |
|
162 | 203 | </body> |
|
0 commit comments