Reveal photos on scroll on Location page

This commit is contained in:
2021-11-18 22:06:29 +01:00
parent 7900c124d2
commit fd871d55f9
3 changed files with 93 additions and 6 deletions

View File

@@ -244,16 +244,16 @@
isIntersecting && observerPhotos.unobserve(target)
})
}, {
threshold: 0,
threshold: 0.3,
rootMargin: '0px 0px 0px'
})
// Photos MutationObserver
mutationPhotos = new MutationObserver((mutationsList, observer) => {
// Use traditional 'for loops' for IE 11
for (const mutation of mutationsList) {
// When adding new childs
if (mutation.type === 'childList') {
console.log('A child node has been added or removed.')
// Observe new items
mutation.addedNodes.forEach((item: HTMLElement) => observerPhotos.observe(item))
}
}