transitionend event fires twice

后端 未结 6 786
渐次进展
渐次进展 2020-12-04 19:33

I have the following code and my problem is that the transitionend event is fired twice. I don\'t know what\'s causing this. I suspected the vendor prefixes cau

6条回答
  •  爱一瞬间的悲伤
    2020-12-04 20:11

    transitionend fires for each property transitioned, in your case top and left.

    You can access the property associated with the event at event.propertyName.

    There's no "transitionsend" event, so you will probably need some hackiness such as filtering the transitionend callback handling for only one of the transitioned properties. E.g.:

    function (event) {
        if (event.propertyName == 'top') {
            //put your code here
        }
    });
    

    ps. No browser fires the MSTransitionEnd event. It was at some point in the MS docs, but sometime before the IE10 beta release it was replaced by the standard transitionend event.

提交回复
热议问题