CSS .btn { border: 1px solid #333; text-align: center; padding: 10px; font-size: 2em; cursor: pointer; background-color: red; color: white; } .btn:hover { box-shadow: 3px 3px black; } .start { position: absolute; width: 30%; top: 20px; left: 35%; z-index: 1; } .gameArea { width: 60%; margin: auto; border: 1px solid #eee; } .cell { float: left; } .col { min-width: 100px; width: 19%; border: 1px solid #eee; padding: 0; } .main { height: 100vh; min-width: 800px; } .case { position: absolute; min-width: 100px; width: 10%; height: 60px; font-family: fantasy; font-size: 3em; text-align: center; padding-top: 40px; border: 1px solid #ccc; cursor: pointer; border-radius: 25px; } .sideVal { margin: auto; position: absolute; width: 100px; height: 35px; border: 1px solid black; text-align: center; font-size: 1.5em; border-radius: 5px; } .close { color: #333; float: right; font-size: 2em; font-weight: bold; } .close:hover { color: red; text-decoration: none; cursor: pointer; } .modal1, .modal2 { display: none; position: fixed; background-color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0.4); width: 100%; height: 100%; left: 0; top: 0; padding-top: 120px; z-index: 1; } .modal-content { background-color: #eee; margin: auto; min-height: 200px; padding: 30px; width: 50%; border-radius: 15px; } .modal-body, .modal-body2 { text-align: center; font-size: 2em; } .deal { background-color: green; } .noDeal { background-color: red; } .offers { width: 40%; height: 50px; font-size: 2em; display: inline-block; color: white; text-align: center; padding: 2px; margin: 3%; } .offers:hover { color: aliceblue; font-weight: bold; cursor: pointer; } JavaScript const app = function () { const vals = [100, 2, 3, 4, 5, 6, 7, 8, 10, 15, 20, 40, 50, 75, 1, 200]; const page = {}; const game = {}; let sideVals = []; vals.sort(function (a, b) { return a - b; }) game.offers = [100, 14, 4, 12, 2, 1].filter(function (x) { return x < vals.length; }) game.offers.sort(function (a, b) { return b - a; }) function init() { page.modal1 = document.querySelector('.modal1'); page.modal2 = document.querySelector('.modal2'); page.modalBody = document.querySelector('.modal-body'); page.modalBody2 = document.querySelector('.modal-body2'); page.start = document.querySelector('.start'); page.start.addEventListener('click', startGame); page.con = document.querySelector('.gameArea'); page.main = document.querySelector('.main'); page.leftSide = document.querySelector('.leftSide'); page.rightSide = document.querySelector('.rightSide'); game.inPlay = false; document.querySelector('.close').addEventListener('click', closePopUp); window.onclick = function (e) { if (e.target == page.modal1) { closePopUp(); } } } function closePopUp() { page.modal1.style.display = 'none'; ///add offer logic } function startGame() { console.log('game started'); page.start.style.display = 'none'; buildGameBoard(); game.lastOffer = false; game.inPlay = true; game.offerMade = 0; popUp('

Select a Case

Click any of the below cases'); } function popUp(message) { console.log(message); page.modal1.style.display = "block"; page.modalBody.innerHTML = message; } function buildGameBoard() { //build board sideVal = []; const val2 = vals.slice(0); page.con.innerHTML = ""; game.holdingArray = []; page.main.style.width = window.innerWidth + 'px'; let tempCon = page.con.getBoundingClientRect(); console.log(tempCon); let tempSide = page.rightSide.getBoundingClientRect(); let spacer = (tempCon.width / 4) - 10; let ver = tempCon.top + 10; let hor = tempCon.left - (spacer / 1.2); let sideTop = 0; let leftHor = tempSide.width / 3; for (let x = 0; x < vals.length; x++) { sideVal[x] = document.createElement('div'); sideVal[x].classList.add('sideVal'); sideVal[x].textContent = vals[x]; if (x == Math.round(vals.length / 2)) { sideTop = 0; leftHor = tempSide.left + (tempSide.width / 3); } sideVal[x].style.left = leftHor + 'px'; sideVal[x].style.top = sideTop + 'px'; sideTop += 40; if (x < (vals.length / 2)) { page.leftSide.appendChild(sideVal[x]); } else { page.rightSide.appendChild(sideVal[x]); } let maker = document.createElement('div'); let ranIndex = Math.floor(Math.random() * val2.length); let temp = val2.splice(ranIndex, 1)[0]; console.log(temp); console.log(val2); hor += spacer; maker.val = temp; maker.ind = x + 1; maker.classList.add('case'); maker.textContent = x + 1; maker.style.left = hor + 'px'; maker.style.top = ver + 'px'; maker.addEventListener('click', checkCase); page.con.appendChild(maker); if ((x % 4) == 3) { ver += 130; hor = tempCon.left - (spacer / 1.2); } } function checkCase(e) { console.log(e.target.val); } } return { init: init } }(); document.addEventListener('DOMContentLoaded', app.init);