javascript webkitTransitionEnd 不触发

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15103949/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 23:30:58  来源:igfitidea点击:

webkitTransitionEnd not firing

javascriptcsswebkit-transform

提问by mikew

I'm not sure what exactly happened, but I am pretty sure this was working at one point.

我不确定到底发生了什么,但我很确定这在某一时刻有效。

The event just isn't firing (or I am not catching it properly)

事件没有触发(或者我没有正确捕捉它)

var $zoomBox = $('#zoomBox');
$zoomBox.bind('webkitTransitionEnd', function(e) {
    alert("test");
});
$('.button').click(function (e) {
    $zoomBox.css('-webkit-transform', 'matrix(2,1,1,2,300, 100)');
});

see fiddle below. After the box finishes transitioning, an alert should pop up, but the alert is not displaying.

见下面的小提琴。框完成转换后,应弹出警报,但未显示警报。

http://jsfiddle.net/cGwb4/1/

http://jsfiddle.net/cGwb4/1/

回答by jfriend00

There's no transition specified in the CSS, so you aren't getting a transition at all. You're just changing the CSS for which there is no webkitTransitionEndevent.

CSS 中没有指定过渡,因此您根本没有获得过渡。您只是在更改没有webkitTransitionEnd事件的 CSS 。

See the fixed example here (in Chrome or Safari): http://jsfiddle.net/jfriend00/75Mh2/where I've added:

请参阅此处的固定示例(在 Chrome 或 Safari 中):http: //jsfiddle.net/jfriend00/75Mh2/,其中我已添加:

-webkit-transition: -webkit-transform 3s;