mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig.space.git
synced 2025-12-13 16:26:50 +00:00
deploy: 0d3f9850b6
This commit is contained in:
@@ -43,12 +43,15 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
"IntersectionObserverEntry" in window &&
|
||||
"intersectionRatio" in window.IntersectionObserverEntry.prototype
|
||||
) {
|
||||
const headerObserver = new IntersectionObserver(entries => {
|
||||
const { boundingClientRect: { y, height } } = entries[0]
|
||||
const fn = Math.abs(y) > height ? 'add' : 'remove'
|
||||
document.body.classList[fn]('topbar')
|
||||
})
|
||||
headerObserver.observe(document.getElementById('header-anchor'))
|
||||
const headerAnchor = document.getElementById('header-anchor')
|
||||
if (headerAnchor) {
|
||||
const headerObserver = new IntersectionObserver(entries => {
|
||||
const { boundingClientRect: { y, height } } = entries[0]
|
||||
const fn = Math.abs(y) > height ? 'add' : 'remove'
|
||||
document.body.classList[fn]('topbar')
|
||||
})
|
||||
headerObserver.observe(headerAnchor)
|
||||
}
|
||||
}
|
||||
|
||||
// List shuffling
|
||||
Reference in New Issue
Block a user