From 54cbb86f686710dc8cb450ee2c2c42d93a9d03cd Mon Sep 17 00:00:00 2001 From: hossainemruz Date: Wed, 17 Jun 2020 05:54:17 +0600 Subject: [PATCH] Fix adjust skill cards handling --- static/assets/js/home.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/static/assets/js/home.js b/static/assets/js/home.js index f9b278c..6025532 100644 --- a/static/assets/js/home.js +++ b/static/assets/js/home.js @@ -91,15 +91,18 @@ var projectCards; function adjustSkillCardsHeight() { if (!isMobile) { // no need to adjust height for mobile devices // primary skills - var el = document.getElementById("primary-skills").children; - var maxHeight = 0; - for (let i = 0; i < el.length; i++) { - if (el[i].children[0].clientHeight > maxHeight) { - maxHeight = el[i].children[0].clientHeight; + var skillCards = document.getElementById("primary-skills"); + if (skillCards != null) { + var el = skillCards.children; + 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 < el.length; i++) { + el[i].children[0].setAttribute("style", "min-height: " + maxHeight + "px;") } - } - for (let i = 0; i < el.length; i++) { - el[i].children[0].setAttribute("style", "min-height: " + maxHeight + "px;") } } }