Replaced jQuery UI by Animate.css (better, faster, lighter)

This commit is contained in:
Bernd Bestel
2020-01-28 19:27:18 +01:00
parent 6f549bdf3a
commit 8d490351d0
23 changed files with 109 additions and 158 deletions

View File

@@ -153,3 +153,22 @@ $.fn.isVisibleInViewport = function(extraHeightPadding = 0)
return elementTop + $(this).outerHeight() > viewportTop && elementTop < viewportTop + $(window).height();
};
function animateCSS(selector, animationName, callback, speed = "faster")
{
var nodes = $(selector);
nodes.addClass('animated').addClass(speed).addClass(animationName);
function handleAnimationEnd()
{
nodes.removeClass('animated').removeClass(speed).removeClass(animationName);
nodes.unbind('animationend', handleAnimationEnd);
if (typeof callback === 'function')
{
callback();
}
}
nodes.on('animationend', handleAnimationEnd);
}