Fixes #2 interaction observer unobserving and loading before on page.
This commit is contained in:
parent
0708328647
commit
0036bcf0fd
@ -185,8 +185,7 @@ module.exports = {
|
|||||||
|
|
||||||
document.querySelectorAll("article").forEach((a) => {
|
document.querySelectorAll("article").forEach((a) => {
|
||||||
if ( a.getAttribute("data-template") != "none" ) {
|
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 => {
|
articles.forEach(article => {
|
||||||
let a = article.target;
|
let a = article.target;
|
||||||
|
|
||||||
@ -278,7 +277,7 @@ module.exports = {
|
|||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
}, { threshold: 0, rootMargin: (document.body.clientHeight / 2) + "px" })
|
||||||
|
|
||||||
observer.observe(a);
|
observer.observe(a);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user