Fixes #2 interaction observer unobserving and loading before on page.

This commit is contained in:
A McIlwraith 2024-07-15 12:24:35 -04:00
parent 0708328647
commit 0036bcf0fd

View File

@ -185,8 +185,7 @@ module.exports = {
document.querySelectorAll("article").forEach((a) => {
if ( a.getAttribute("data-template") != "none" ) {
// why are threshold: 0, rootMargin: 50vh throwing an error?
const observer = new IntersectionObserver((articles, { }) => {
const observer = new IntersectionObserver(articles => {
articles.forEach(article => {
let a = article.target;
@ -278,7 +277,7 @@ module.exports = {
}
})
})
}, { threshold: 0, rootMargin: (document.body.clientHeight / 2) + "px" })
observer.observe(a);