WebkitAnimationEnd没有触发。谁能明白为什么?

时间:2012-07-24 16:14:48

标签: javascript css3 javascript-events listener

我最近开始搞乱Javascript,可以在我的工作中看到动画结束监听器的一些不错的应用程序。我有以下代码,我的动画结尾的听众都没有被解雇。任何人都可以看到为什么两个听众中的任何一个都不工作?我正在寻找Chrome。

http://jsfiddle.net/spacebeers/jkUyT/1/

感谢。

#animationTest {
    width: 150px;
    text-align: center;
    display: block;
    padding: 20px;
    background: #000;
    color: #fff;
    border-bottom: 10px solid red;
    cursor: pointer;
            transition: border-bottom 0.5s linear; /* vendorless fallback */
         -o-transition: border-bottom 0.5s linear; /* opera */
        -ms-transition: border-bottom 0.5s linear; /* IE 10 */
       -moz-transition: border-bottom 0.5s linear; /* Firefox */
    -webkit-transition: border-bottom 0.5s linear; /*safari and chrome */
}

#animationTest:hover {
    border-bottom: 10px solid blue;
}

<a id="animationTest">Hover over me</a>

$('document').ready(function(){
    var animationTest = document.getElementById('animationTest');

    animationTest.addEventListener('webkitAnimationEnd', function(event){
            alert("Finished animation (listener)!");
            console.log("Finished animation (listener)!");
        }, false );

        $('#animationTest').bind("webkitAnimationEnd", function(event){
            alert("Finished animation (bind)!");
            console.log("Finished animation (bind)!");
        }, false );
});

1 个答案:

答案 0 :(得分:15)

应为webkitTransitionEnd

http://jsfiddle.net/jkUyT/3/