Hide/show markers
This commit is contained in:
parent
d43d48362b
commit
f7ef285292
1 changed files with 9 additions and 0 deletions
|
@ -36,6 +36,15 @@ function init() {
|
||||||
function render() {
|
function render() {
|
||||||
// Render the board
|
// Render the board
|
||||||
board.forEach(function(colArr, colIdx) {
|
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}`);
|
||||||
|
// <conditional exp> ? <truthy thing to return> : <falsey thing to return>;
|
||||||
|
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) {
|
colArr.forEach(function(cell, rowIdx) {
|
||||||
let div = document.getElementById(`c${colIdx}r${rowIdx}`);
|
let div = document.getElementById(`c${colIdx}r${rowIdx}`);
|
||||||
div.style.backgroundColor = COLORS[cell];
|
div.style.backgroundColor = COLORS[cell];
|
||||||
|
|
Loading…
Reference in a new issue