Fix active issue
This commit is contained in:
parent
8936dc45be
commit
bff59baa04
1 changed files with 5 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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue