master
parent
e2aac4800a
commit
6b7d1444c9
|
@ -232,7 +232,9 @@
|
||||||
if (entry.isIntersecting) {
|
if (entry.isIntersecting) {
|
||||||
// Remove the element to remove
|
// Remove the element to remove
|
||||||
elementToRemove.classList.remove('show');
|
elementToRemove.classList.remove('show');
|
||||||
setTimeout(() => elementToRemove.style.display = 'none', 1200);
|
setTimeout(() => {
|
||||||
|
if(!elementToRemove.classList.includes('show')) elementToRemove.style.display = 'none';
|
||||||
|
}, 800);
|
||||||
} else {
|
} else {
|
||||||
const fixedElementRect = elementToRemove.getBoundingClientRect();
|
const fixedElementRect = elementToRemove.getBoundingClientRect();
|
||||||
const referenceElementRect = targetElement.getBoundingClientRect();
|
const referenceElementRect = targetElement.getBoundingClientRect();
|
||||||
|
@ -240,12 +242,13 @@
|
||||||
if (fixedElementRect.bottom < referenceElementRect.top) {
|
if (fixedElementRect.bottom < referenceElementRect.top) {
|
||||||
// Show the element to remove
|
// Show the element to remove
|
||||||
elementToRemove.style.display = 'block';
|
elementToRemove.style.display = 'block';
|
||||||
setTimeout(() => elementToRemove.classList.add('show'), 1200);
|
elementToRemove.classList.add('show');
|
||||||
} else {
|
} else {
|
||||||
// Hide the element to remove
|
// Hide the element to remove
|
||||||
//elementToRemove.style.display = 'none';
|
|
||||||
elementToRemove.classList.remove('show');
|
elementToRemove.classList.remove('show');
|
||||||
setTimeout(() => elementToRemove.style.display = 'none', 1200);
|
setTimeout(() => {
|
||||||
|
if(!elementToRemove.classList.includes('show')) elementToRemove.style.display = 'none';
|
||||||
|
}, 800);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Stop observing once it's removed (optional)
|
// Stop observing once it's removed (optional)
|
||||||
|
|
Loading…
Reference in New Issue