From 0ae75b7845afb222653d95caee9ed838dfa442d9 Mon Sep 17 00:00:00 2001 From: Yuriy Date: Thu, 23 Jul 2020 01:36:12 +0200 Subject: [PATCH] call adjustSkillCardsHeight after page is loaded --- static/assets/js/home.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/static/assets/js/home.js b/static/assets/js/home.js index 5ad0bf2..fd248b4 100644 --- a/static/assets/js/home.js +++ b/static/assets/js/home.js @@ -69,20 +69,22 @@ var projectCards; // primary skills var skillCards = document.getElementById("primary-skills"); if (skillCards != null) { - var el = skillCards.children; + var cardElems = skillCards.getElementsByClassName("card"); var maxHeight = 0; - for (let i = 0; i < el.length; i++) { - if (el[i].children[0].clientHeight > maxHeight) { - maxHeight = el[i].children[0].clientHeight; + for (let i = 0; i < cardElems.length; i++) { + if (cardElems.item(i).clientHeight > maxHeight) { + maxHeight = cardElems.item(i).clientHeight; } } - for (let i = 0; i < el.length; i++) { - el[i].children[0].setAttribute("style", "min-height: " + maxHeight + "px;") + for (let i = 0; i < cardElems.length; i++) { + cardElems.item(i).setAttribute("style", "min-height: " + maxHeight + "px;"); } } } } - adjustSkillCardsHeight(); + $(window).on("load", function () { + adjustSkillCardsHeight(); + }); // ================== Project cards ===================== // Add click action on project category selector buttons