Home › Forums › JavaScript › 2 images activate the same animation, how would you ensure that the animation happens only once? › Re: 2 images activate the same animation, how would you ensure that the animation happens only once?
June 5, 2013 at 11:34 am
#137752
Smitty
Member
You could set a variable with either true or false as it’s value, and check that before you animate.
rough example
var hovered = false;
if ( !hovered){
$(‘#hoverElement’).mouseOver(function(){
hovered = true;
});
$(‘#hoverElement’).mouseOut(function(){
hovered = false;
});
}