Skip to content

Instantly share code, notes, and snippets.

@olirabt
Created January 6, 2017 13:56
Show Gist options
  • Save olirabt/afd730c5da6404d1280e822ca6bf281f to your computer and use it in GitHub Desktop.
Save olirabt/afd730c5da6404d1280e822ca6bf281f to your computer and use it in GitHub Desktop.
Animation au chargement d'articles en ajax (wordpress)
var AnimationArticles = function(articlesBruts, articlesContainersTab) {
this.articlesBruts = articlesBruts;
this.articlesContainersTab = articlesContainersTab;
this.newlyLoadedTab = [];
this.articlesTraites;
this.newlyLoadedContainer;
this.init();
}
AnimationArticles.prototype.init = function(){
$('.newlyLoadedActu').removeClass('newlyLoadedActu');
this.parsing();
};
AnimationArticles.prototype.getNewlyLoadedContainer = function(){
return this.newlyLoadedContainer;
};
AnimationArticles.prototype.parsing = function(){
this.newlyLoadedContainer = document.createElement('div');
this.newlyLoadedContainer.innerHTML = this.articlesBruts;
this.newlyLoadedContainer.className += 'newlyLoadedActu';
this.newlyLoadedTab = $('.newlyLoadedActu').find('.media');
};
AnimationArticles.prototype.animate = function(){
$('.newlyLoadedActu a.media').each(function(index, elem) {
setTimeout(function() {
TweenMax.to($(elem), 0.8, { opacity: 1, ease: Sine.easeOut, }); }, index * 220);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment