Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WOW.js Reanimate Single Elements without init() - delayed
// If you want to explicitly trigger an animation for certain WOW.js elements again. No need to call `init()` and also not wanted (all elements are reset):
var triggerAnimation = function(selector, animation) {
var $element = $(selector); // get element
// re-apply animation (style and class)
var applyAnimation = function(){
$element = $(selector);
$element.addClass('wow ' + animation + ' animated');
$element.attr('style', 'visibility: visible; animation-name: ' + animation + ';');
};
// remove elements if not currently animated and re-apply
if(!$element.hasClass('animated')) {
$element.removeAttr('style');
$element.removeClass('wow').removeClass(animation)
// re-apply styling after 25ms delay
setTimeout(applyAnimation, 25);
}
};
triggerAnimation('.your_selector, 'zoomIn'); // element to reanimate and animation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment