From f7ef28529216f64130f84c3830880b27884798ce Mon Sep 17 00:00:00 2001 From: jim-clark Date: Fri, 26 Jul 2019 14:48:06 -0700 Subject: [PATCH] Hide/show markers --- js/main.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/main.js b/js/main.js index 84aec9e..dc9894d 100644 --- a/js/main.js +++ b/js/main.js @@ -36,6 +36,15 @@ function init() { function render() { // Render the board board.forEach(function(colArr, colIdx) { + // hide/show the column's marker depending if there are 0's or not + let marker = document.getElementById(`col${colIdx}`); + // ? : ; + marker.style.visibility = colArr.indexOf(0) === -1 ? 'hidden' : 'visible'; + // if (colArr.indexOf(0) === -1) { + // marker.style.visibility = 'hidden'; + // } else { + // marker.style.visibility = 'visible'; + // } colArr.forEach(function(cell, rowIdx) { let div = document.getElementById(`c${colIdx}r${rowIdx}`); div.style.backgroundColor = COLORS[cell];