0

如何在不支持的浏览器上处理绑定过渡端?

如果我有

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

我怎样才能让它在ie8中工作?如果浏览器支持,我尝试创建一个包含“transitionend”的字符串,如果不支持,则创建一个包含“change”的字符串,但我认为这不是一个好主意。

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

有什么建议吗?

4

1 回答 1

0

您可以尝试使用 cssHooks 在 css 上添加自定义触发器

示例http://jsbin.com/Ug​​iCUd/

于 2013-10-08T16:51:54.420 回答