Reveal photos on scroll on Location page
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user