动画完成,不称为JavaScript DOM

问题描述 投票:0回答:1

我正在尝试使用补全功能对图像进行动画处理。动画工作正常,但未调用complete属性。我尝试环顾四周,但在发现我在做错的事情上没有发现任何结果。我在ChromeFirefox上使用了下面的代码

        document.getElementById("myImageId").animate([
            { transform: 'translateY(0px)' },
            { transform: 'translateY(-300px)' }
        ], {
            duration: 300,
            complete: function() { alert('end ani') }
        });
javascript dom
1个回答
1
投票

[Element.animate()返回一个Element.animate()对象,并且您可以将Animation的事件处理程序附加到该对象:

Animation
finish
© www.soinside.com 2019 - 2024. All rights reserved.