Uncommend not working exit stream animation javascript code

This commit is contained in:
2024-09-14 13:07:54 +02:00
parent 3924b8f6f6
commit b306148120

View File

@@ -22,17 +22,17 @@ document.addEventListener("turbo:before-stream-render", function(event) {
// 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)
if (elementToRemove) {
var streamExitClass = elementToRemove.dataset.streamExitClass
if (streamExitClass) {
// Intercept the removal of the element
event.preventDefault()
elementToRemove.classList.add(streamExitClass)
// Wait for its animation to end before removing the element
elementToRemove.addEventListener("animationend", function() {
event.target.performAction()
})
}
}
// var elementToRemove = document.getElementById(event.target.target)
// if (elementToRemove) {
// var streamExitClass = elementToRemove.dataset.streamExitClass
// if (streamExitClass) {
// // Intercept the removal of the element
// event.preventDefault()
// elementToRemove.classList.add(streamExitClass)
// // Wait for its animation to end before removing the element
// elementToRemove.addEventListener("animationend", function() {
// event.target.performAction()
// })
// }
// }
})