Browse Source

fix fade alert

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

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

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