Callback para CSS3 transitions

Para pessoas que estão acostumadas com o método animate do jQuery, que tem um callback, trabalhar com CSS3 pode ser um pouco complicado. Aqui vai uma dica rápida pra adicionar callbacks às suas transições.

Existe um método que tem nomes diferentes para Mozilla, webkit e Opera, respectivamente:

  • transitionend
  • webKitTransitionEnd
  • oTransitionEnd
element.addEventListener(
    'transitionend', //depende do browser (listado acima)
    function( event ) {
        alert( "Finished transition!" );
    },
    false
);

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>