jquery - Transition End Fallback for ie9 -
i'm using following code jquery trigger events on transitionend , avoid multiple callback/support multiple browsers:
function whichtransitionevent(){ var t; var el = document.createelement('fakeelement'); var transitions = { 'transition':'transitionend', 'otransition':'otransitionend', 'moztransition':'transitionend', 'webkittransition':'webkittransitionend' } for(t in transitions){ if( el.style[t] !== undefined ){ return transitions[t]; } } }
(code found here: http://davidwalsh.name/css-animation-callback)
however, seems ie9 doesn't support transitionend regardless of prefix/syntax. how set fallback ie9 when i'm using in scenario following (to remove loading screen dom after animation complete)?
$('#loading').one(transitionevent, function(event) { $('#loading').remove(); });
i've seen several answers how prevent multiple callbacks using similar function 1 @ top of post, not understanding how create fallback. help!
var transitionevent = whichtransitionevent(); // bind event $('#loading').one(transitionevent, function(event) { $('#loading').remove(); }); // if event not supported e.g. ie <= 9 if (! transitionevent) { $('#loading').trigger(transitionevent); }
the function returns falsy value (undefined), if event not supported.
Comments
Post a Comment