|
24 | 24 | color: #d4d5d7; |
25 | 25 | font-family: 'Inter', system-ui, sans-serif; |
26 | 26 | text-align: center; |
27 | | - scroll-snap-type: y proximity; |
28 | 27 | } |
29 | 28 |
|
30 | 29 | body { |
|
36 | 35 | padding: 0 20px; |
37 | 36 | } |
38 | 37 |
|
39 | | - .top-snap-marker { |
40 | | - scroll-snap-align: start; |
41 | | - } |
42 | | - |
43 | 38 | .logo { |
44 | 39 | width: 70px; |
45 | 40 | border-radius: 22.5%; |
46 | 41 | border: 1px solid rgba(255,255,255,.1); |
47 | 42 | margin: 0 auto; |
| 43 | + margin-bottom: 24px; |
48 | 44 | margin-top: 50px; |
49 | | - position: relative; |
50 | | - z-index: 1000; |
51 | 45 | } |
52 | 46 |
|
53 | 47 | .title { |
54 | 48 | font-size: 19px; |
55 | 49 | margin-bottom: 24px; |
56 | | - padding-top: 24px; |
57 | 50 | margin-top: 0; |
| 51 | + position: relative; |
58 | 52 | text-align: center; |
59 | | - position: sticky; |
60 | | - z-index: 999; |
61 | | - top: 0; |
62 | | - scroll-snap-align: start; |
63 | | - } |
64 | | - |
65 | | - .title::before { |
66 | | - content: ''; |
67 | | - position: fixed; |
68 | | - left: 0; |
69 | | - top: 0; |
70 | | - right: 0; |
71 | | - background: linear-gradient(180deg, #1a1c24 calc(100% - 23px), #1a1c2400); |
72 | | - height: calc(24px + 23px + 24px + 12px); |
73 | | - z-index: -1; |
74 | | - } |
75 | | - |
76 | | - .center { |
77 | | - scroll-snap-align: center; |
78 | 53 | } |
79 | 54 |
|
80 | 55 | .button { |
|
162 | 137 | </head> |
163 | 138 |
|
164 | 139 | <body ontouchstart=""> |
165 | | - <div class="top-snap-marker"></div> |
166 | 140 | <img class="logo" src="/icons/iphone-app-180.png" width="80" draggable="false" alt="Codeit"> |
167 | 141 | <p class="title">Supported languages</p> |
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> |
| 142 | + <div class="languages" style="display: inline-block;line-height: 1.5;text-align: left;width: max-content;margin: auto;">Just a sec...</div> |
169 | 143 | <p style="margin-top: 50px;margin-bottom: 50px;"> |
170 | 144 | <a href="/" style="color: inherit;">- ❤️ Codeit team</a> |
171 | 145 | </p> |
172 | 146 |
|
173 | 147 | <script src="https://prismjs.com/components.js"></script> |
174 | 148 | <script> |
175 | 149 |
|
176 | | - const languages = Object.keys(components.languages); |
177 | 150 | let out = ''; |
178 | | - |
179 | | - out += '<p style="margin-top:0;margin-bottom:7px;">'+ languages.length +' languages</p>'; |
180 | | - |
181 | | - languages.forEach(lang => { |
| 151 | + |
| 152 | + Object.keys(components.languages).forEach(lang => { |
182 | 153 |
|
183 | 154 | out += '<li>' + lang + '</li>'; |
184 | 155 |
|
185 | 156 | }); |
186 | 157 |
|
187 | 158 | document.querySelector('.languages').innerHTML = out; |
188 | 159 |
|
189 | | - |
190 | | - // scroll listener |
191 | | - |
192 | | - const scrollEl = document.documentElement, |
193 | | - title = document.querySelector('.title'), |
194 | | - scrollEnd = title.offsetTop, |
195 | | - logo = document.querySelector('.logo'); |
196 | | - |
197 | | - window.addEventListener('scroll', () => { |
198 | | - |
199 | | - const scrollPos = scrollEl.scrollTop; |
200 | | - |
201 | | - if (scrollPos <= scrollEnd) { |
202 | | - |
203 | | - const opacityPercent = 1 - (scrollPos / scrollEnd); |
204 | | - logo.style.opacity = opacityPercent; |
205 | | - |
206 | | - } |
207 | | - |
208 | | - }); |
209 | | - |
210 | 160 | </script> |
211 | 161 |
|
212 | 162 | </body> |
|
0 commit comments