-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch opencollective image listing and avatars fadein
- Loading branch information
Showing
5 changed files
with
35 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
(function () { | ||
'use strict'; | ||
// dumb thing that helps with animation of avatars | ||
var avatars = window.avatars = function (type) { | ||
return function avatarLoaded () { | ||
avatars[type] = typeof avatars[type] === 'number' ? avatars[type] + 1 : 1; | ||
if (avatars[type] === 30) { | ||
document.getElementById(type).classList.add('onload'); | ||
|
||
var imageLists = document.querySelectorAll('.image-list'); | ||
|
||
Array.prototype.forEach.call(imageLists, function (imageList) { | ||
var images = imageList.querySelectorAll('img'); | ||
var counter = images.length; | ||
|
||
function onloadHandler() { | ||
counter -= 1; | ||
|
||
if (counter === 0) { | ||
imageList.classList.add('is-loaded'); | ||
} | ||
}; | ||
}; | ||
} | ||
|
||
for (var i = 0; i < images.length; i += 1) { | ||
images[i].onload = onloadHandler; | ||
} | ||
}); | ||
|
||
avatars.backerLoaded = avatars('_backers'); | ||
avatars.sponsorLoaded = avatars('_sponsors'); | ||
}()); |