Skip to content

Instantly share code, notes, and snippets.

@gkobilansky
Created January 3, 2017 15:32
Show Gist options
  • Save gkobilansky/798fa05c8c4c578017ce70f4ef61e6e6 to your computer and use it in GitHub Desktop.
Save gkobilansky/798fa05c8c4c578017ce70f4ef61e6e6 to your computer and use it in GitHub Desktop.
/* Animations
* ------------------------------------------------------- */
var ssAnimations = function() {
if (!$("html").hasClass('no-cssanimations')) {
$('.animate-this').waypoint({
handler: function(direction) {
var defAnimationEfx = cfg.defAnimation;
if ( direction === 'down' && !$(this.element).hasClass('animated')) {
$(this.element).addClass('item-animate');
setTimeout(function() {
$('body .animate-this.item-animate').each(function(ctr) {
var el = $(this),
animationEfx = el.data('animate') || null;
if (!animationEfx) {
animationEfx = defAnimationEfx;
}
setTimeout( function () {
el.addClass(animationEfx + ' animated');
el.removeClass('item-animate');
}, ctr * 50);
});
}, 100);
}
// trigger once only
this.destroy();
},
offset: '95%'
});
}
};
/* Intro Animation
* ------------------------------------------------------- */
var ssIntroAnimation = function() {
$WIN.on('load', function() {
if (!$("html").hasClass('no-cssanimations')) {
setTimeout(function(){
$('.animate-intro').each(function(ctr) {
var el = $(this),
animationEfx = el.data('animate') || null;
if (!animationEfx) {
animationEfx = cfg.defAnimation;
}
setTimeout( function () {
el.addClass(animationEfx + ' animated');
}, ctr * 300);
});
}, 100);
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment