I have a code:
$('#sectionName').on('animationend webkitAnimationEnd oAnimationEnd', function () {
alert("Hello");
});
which is meant to trigger the alert when animation of #sectionName ends.
It does its job but it is also triggered first time the website is launched.
Is there a way to prevent it? Some way to trigger this alert only when the animationend event is heard for the second time?
PS I am using wow.js, so the #sectionName object slides in, after scrolling to certain page point, and then I want the alert to be displayed.
Try it simple:
Var firstTime = true
$('#sectionName').on('animationend webkitAnimationEnd oAnimationEnd', function () {
if(firstTime){
firstTime = false;
return;
}
alert("Hello");
});