Skip to content

Instantly share code, notes, and snippets.

@thexmanxyz
Last active March 29, 2020 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thexmanxyz/b29a575f3f8b4a90bdad59d6e97a650d to your computer and use it in GitHub Desktop.
Save thexmanxyz/b29a575f3f8b4a90bdad59d6e97a650d to your computer and use it in GitHub Desktop.
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