From 123ee4f42388700eb16c85630ae23a3e298bc70f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20M=C3=BCller?= Date: Mon, 18 Dec 2017 23:11:54 +0100 Subject: [PATCH] Handle the case where all avatars are already loaded at the time when the script exexecutes --- docs/js/avatars.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/js/avatars.js b/docs/js/avatars.js index 3c60984741..7706fa1e5b 100644 --- a/docs/js/avatars.js +++ b/docs/js/avatars.js @@ -18,6 +18,10 @@ for (var i = 0; i < images.length; i += 1) { if (images[i].complete) { counter -= 1; + + if (counter === 0) { + imageList.classList.add('is-loaded'); + } } else { images[i].onload = onloadHandler; images[i].onerror = onloadHandler;