Browse Source

fix fade alert

main
Christoph Marzell 2 months ago
parent
commit
837b7f6e47
  1. 15
      app/views/layouts/application.html.erb

15
app/views/layouts/application.html.erb

@ -176,16 +176,15 @@
document.addEventListener("turbo:load", function () { document.addEventListener("turbo:load", function () {
console.log("🚀 Turbo geladen"); console.log("🚀 Turbo geladen");
const alerts = document.querySelectorAll(".alert");
alerts.forEach(function(alert) {
const container = document.getElementById("alert-notice");
if (!container) return;
const alerts = container.querySelectorAll(".alert");
alerts.forEach(function (alertEl) {
setTimeout(function () { setTimeout(function () {
alert.classList.add("fade");
setTimeout(() => alert.remove(), 500); // Clean removal
alertEl.classList.add("fade");
setTimeout(() => alertEl.remove(), 500);
}, 2000); }, 2000);
}); });
}); });
</script> </script>
Loading…
Cancel
Save