Click function is working properly.
But if we click the hand img more than one time it is not working when page is reloaded, below is the code.
$(document).ready(function(){ $("#container .like a img").click(function(){ $("#container .balloons a img").addClass("anima"); }); });
I want more than one click will be work, please solve the problem.
Here is the fiddle: http://jsfiddle.net/vamsivelaga/n3no4759/
Asked
Active
Viewed 299 times
0

leppie
- 115,091
- 17
- 196
- 297

Vamsi Velaga
- 15
- 7
-
The answer to this question provides good insight - http://stackoverflow.com/questions/4797675/how-do-i-re-trigger-a-webkit-css-animation-via-javascript – Chintan S Jan 21 '15 at 07:37
2 Answers
3
check this out
$("#container .like a img").on("click", function(){
$("#container .balloons a img").addClass("anima").one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend' , function(event){
$(this).removeClass("anima");
});
});
here the working solution

Muhaimin
- 1,643
- 2
- 24
- 48
0
The problem is that you don't remove anima
class. You can use setTimeout
function to do this:
$(document).ready(function(){
$("#container .like a img").click(function(){
$("#container .balloons a img").addClass("anima");
setTimeout(function() {
$("#container .balloons a img").removeClass("anima");
}, 500)
});
});

segarci
- 739
- 1
- 11
- 19