Reputation: 13947
I've recently started messing about with Javascript and can see some nice applications for the animation end listener in my job. I've got the following code and none of my listeners for the animation ending are firing. Can any one see any reason why either of the two listeners aren't working? I'm looking in 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 );
});
Upvotes: 3
Views: 6126