Add spinner and observer for loading screen

This commit is contained in:
Benjamin Beganović 2024-02-20 17:24:42 +01:00
parent 8e4e6c4f70
commit 1cc17a4af4

View File

@ -13,6 +13,21 @@
document.getElementById('payment-method-form').submit() document.getElementById('payment-method-form').submit()
}, 2000); }, 2000);
}); });
const target = document.getElementById('container');
const observer = new MutationObserver((mutationsList) => {
for (const mutation of mutationsList) {
if (mutation.type === 'childList' || mutation.type === 'subtree') {
setTimeout(() => {
document.getElementById('spinner').classList.add('hidden');
document.getElementById('container').classList.remove('hidden');
}, 1500);
}
}
});
observer.observe(target, { childList: true, subtree: true })
}); });
</script> </script>
@endpush @endpush