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