CSS3 transition events

前端 未结 6 1326
情歌与酒
情歌与酒 2020-11-22 07:18

Are there any events fired by an element to check wether a css3 transition has started or end?

6条回答
  •  抹茶落季
    2020-11-22 07:33

    W3C CSS Transitions Draft

    The completion of a CSS Transition generates a corresponding DOM Event. An event is fired for each property that undergoes a transition. This allows a content developer to perform actions that synchronize with the completion of a transition.


    Webkit

    To determine when a transition completes, set a JavaScript event listener function for the DOM event that is sent at the end of a transition. The event is an instance of WebKitTransitionEvent, and its type is webkitTransitionEnd.

    box.addEventListener( 'webkitTransitionEnd', 
        function( event ) { alert( "Finished transition!" ); }, false );
    

    Mozilla

    There is a single event that is fired when transitions complete. In Firefox, the event is transitionend, in Opera, oTransitionEnd, and in WebKit it is webkitTransitionEnd.

    Opera

    There is one type of transition event available. The oTransitionEnd event occurs at the completion of the transition.

    Internet Explorer

    The transitionend event occurs at the completion of the transition. If the transition is removed before completion, the event will not fire.


    Stack Overflow: How do I normalize CSS3 Transition functions across browsers?

提交回复
热议问题