不支持时jquery绑定transitionend

时间:2013-10-08 15:38:11

标签: jquery cross-browser transitionend

如何在不支持它的浏览器上处理绑定transitionend?

如果我有

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

如何让它在ie8中运行? 如果浏览器支持它,我试图创建一个包含“transitionend”的字符串,如果没有,我会尝试“更改”,但我认为这不是一个好主意。

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

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

您可以尝试使用cssHooks

在css上添加自定义触发器

示例http://jsbin.com/UgiCUd/