Added an other animate but flash ist still the best, exit animation does still not work

This commit is contained in:
2024-09-15 12:27:18 +02:00
parent affc7671c6
commit 7144fea077
2 changed files with 50 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ addEventListener("turbo:before-frame-render", (event) => {
})
// URL: https://edforshaw.co.uk/hotwire-turbo-stream-animations
// and: https://stackoverflow.com/questions/61306601/css-animation-on-table-row-how-to-affect-height
// Alternative Hotwire Animate (Wrapper for Animate.css)
// URL: https://railshackathon.com/entries/12 https://yozu.co.uk/tech-blog-turbocharged-animations-introducing-hotwire-animate/
// Discussion about hotwire animation: https://discuss.hotwired.dev/t/are-transitions-and-animations-on-hotwire-roadmap/1547/10
@@ -33,7 +34,6 @@ document.addEventListener("turbo:before-stream-render", (event) => {
event.target.templateElement.content.firstElementChild.classList.add(enterAnimationClass)
}
}
// Add a class to an element we are about to remove from the page
// as defined by its "data-stream-exit-class"
var elementToRemove = document.getElementById(event.target.target)
@@ -42,7 +42,7 @@ document.addEventListener("turbo:before-stream-render", (event) => {
if (streamExitClass) {
// Intercept the removal of the element
event.preventDefault()
elementToRemove.classList.remove(elementToRemove.dataset.streamEnterClass)
// elementToRemove.classList.remove(elementToRemove.dataset.streamEnterClass)
elementToRemove.classList.add(streamExitClass)
// Wait for its animation to end before removing the element
elementToRemove.addEventListener("animationend", function() {