|
197 | 197 | if (row && sheetContent){ |
198 | 198 | const rowRect = row.getBoundingClientRect(); |
199 | 199 | const sheetContentRect = sheetContent.getBoundingClientRect(); |
200 | | - const menuGap = Math.round(Math.min(Math.max(viewportHeight * 0.17, 114), 148)); |
| 200 | + const menuGap = Math.round(Math.min(Math.max(viewportHeight * 0.19, 126), 162)); |
201 | 201 | const menuTop = Math.round(Math.max(72, rowRect.bottom + menuGap - sheetContentRect.top)); |
202 | 202 | root.style.setProperty('--mobile-menu-top', `${menuTop}px`); |
203 | 203 | } |
|
208 | 208 | const brand = nav.querySelector('.brand'); |
209 | 209 | const logo = nav.querySelector('.brand-logo'); |
210 | 210 | const firstLink = nav.querySelector('.mobile-menu a'); |
211 | | - if (brand && firstLink){ |
| 211 | + if (brand && firstLink && row){ |
212 | 212 | const logoRect = (logo || brand).getBoundingClientRect(); |
213 | 213 | const firstLinkRect = firstLink.getBoundingClientRect(); |
214 | | - const gapAbove = Math.round(Math.min(Math.max(viewportHeight * 0.038, 26), 34)); |
215 | | - const targetTop = firstLinkRect.top - logoRect.height - gapAbove; |
| 214 | + const rowRect = row.getBoundingClientRect(); |
| 215 | + const gapAbove = Math.round(Math.min(Math.max(viewportHeight * 0.028, 18), 24)); |
| 216 | + const alignedTop = firstLinkRect.top - logoRect.height - gapAbove; |
| 217 | + const minLogoTop = Math.round(rowRect.top + 12); |
| 218 | + const targetTop = Math.max(alignedTop, minLogoTop); |
216 | 219 | const shiftX = Math.round(firstLinkRect.left - logoRect.left); |
217 | 220 | const shiftY = Math.round(targetTop - logoRect.top); |
218 | 221 |
|
|
0 commit comments