0

How can I handle the bind transitionend on browsers that don't support it?

If I have

$('#div').bind('transitionend', function(){...});
$('#div').css('width','100px'); //this will start transition if supported

How can I make it working in ie8? I tried to make a string which contains "transitionend" if the browser support it, and "change" if not, but i think it's not a good idea.

var transitionstring = 'transitionend';
if (IE) transitionstring = 'change';
//bind custom handler
$('#div').bind(transitionstring , function(){...});
$('#div').css('width','100px'); //this will start transition if supported, else
//the change event will be triggered

Any suggestion?

Nereo Costacurta
  • 7,693
  • 4
  • 21
  • 27
  • does transitions work on browsers who don't support transitionend? – Einacio Oct 08 '13 at 15:49
  • obviously transition doesn't work in that cases.. but if I want to use transition css3 for my website, and get a callback when transition end, I NEED to support that browser who doesn't know what transitionend is. In their case, a css change will be istantaneous, so, istead of wait for the "transition" I check the "changing" (in my solution) – Nereo Costacurta Oct 08 '13 at 16:02

1 Answers1

0

you can try adding a custom trigger on css using cssHooks

example http://jsbin.com/UgiCUd/

Einacio
  • 3,502
  • 1
  • 17
  • 21