从translateX(100%)到translateX(0%)的过渡没有动画。似乎“ translateX(100%)”值从不适应,而是“跳过”。
el.style.transitionDuration = null
el.style.transform = "translateX(100%)"
el.style.transitionDuration = "100ms"
el.style.transform = "translateX(0%)"
但是这个正在工作
el.style.transitionDuration = null
el.style.transform = "translateX(100%)"
setTimeout(() => {
el.style.transitionDuration = "100ms"
el.style.transform = "translateX(0%)"
}, 5)