Compare commits
2 commits
93ffa4a316
...
bff59baa04
| Author | SHA1 | Date | |
|---|---|---|---|
|
bff59baa04 |
|||
|
8936dc45be |
2 changed files with 10 additions and 6 deletions
|
|
@ -24,11 +24,10 @@ const sections: Array<Page> = [
|
|||
|
||||
<script is:inline define:vars={{ sections }}>
|
||||
document.addEventListener("scroll", () =>
|
||||
sections.forEach(
|
||||
({ id }) =>
|
||||
document.getElementById(id).getBoundingClientRect().bottom <
|
||||
window.innerHeight &&
|
||||
(document.querySelector("mdui-navigation-bar").value = id)
|
||||
)
|
||||
sections.forEach(({ id }) => {
|
||||
const rect = document.getElementById(id).getBoundingClientRect()
|
||||
if (rect.bottom < window.innerHeight || rect.top < 200)
|
||||
document.querySelector("mdui-navigation-bar").value = id
|
||||
})
|
||||
)
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ mdui-card {
|
|||
main > * > section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
scroll-margin-top: 1em;
|
||||
|
||||
& div,
|
||||
mdui-card {
|
||||
|
|
@ -116,4 +117,8 @@ main > * > section {
|
|||
min-width: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1500px) {
|
||||
scroll-margin-top: 5em;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue