master
parent
fe88355eca
commit
2e6fa32c47
|
@ -5,10 +5,13 @@
|
|||
<style>
|
||||
.form-anchor{
|
||||
opacity:0;
|
||||
transition: opacity .6s;
|
||||
transform: translateX(200%);
|
||||
transition: opacity 1s 0s, transform 0s 1s;
|
||||
}
|
||||
.form-anchor.show{
|
||||
opacity:1;
|
||||
transform: translateX(0%);
|
||||
transition: opacity 1s 0s, transform 0s 0s;
|
||||
}
|
||||
</style>
|
||||
@stop
|
||||
|
@ -232,23 +235,16 @@
|
|||
if (entry.isIntersecting) {
|
||||
// Remove the element to remove
|
||||
elementToRemove.classList.remove('show');
|
||||
setTimeout(() => {
|
||||
if(!elementToRemove.classList.contains('show')) elementToRemove.style.display = 'none';
|
||||
}, 700);
|
||||
} else {
|
||||
const fixedElementRect = elementToRemove.getBoundingClientRect();
|
||||
const referenceElementRect = targetElement.getBoundingClientRect();
|
||||
|
||||
if (fixedElementRect.bottom < referenceElementRect.top) {
|
||||
// Show the element to remove
|
||||
elementToRemove.style.display = 'block';
|
||||
elementToRemove.classList.add('show');
|
||||
} else {
|
||||
// Hide the element to remove
|
||||
elementToRemove.classList.remove('show');
|
||||
setTimeout(() => {
|
||||
if(!elementToRemove.classList.contains('show')) elementToRemove.style.display = 'none';
|
||||
}, 700);
|
||||
}
|
||||
}
|
||||
// Stop observing once it's removed (optional)
|
||||
|
@ -258,6 +254,5 @@
|
|||
|
||||
// Observe the target element
|
||||
observer.observe(targetElement);
|
||||
|
||||
</script>
|
||||
@stop
|
||||
|
|
Loading…
Reference in New Issue