// Credit to https://w3bits.com/javascript-modal/ let createModal = (modalContent) => { let modal = document.createElement('div'), modalStyle = document.createElement('style'), modalCSS = '.js-modal{ position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: rgba(0, 0, 0, .8); width: 100%; height: 100%; z-index: 999999; } .js-modal-inner{ background-color: rgba(174, 145, 93, .9); position: relative; padding: 50px; font-size: 24px; max-width: 650px; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #000; border-radius: 10px; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: normal; text-align: center; } .js-modal-inner a { color: #000; text-decoration: underline; }', theBody = document.getElementsByTagName('body')[0], theHead = document.getElementsByTagName('head')[0]; // Add content and attributes to the modal modal.setAttribute('class', 'js-modal'); modal.innerHTML = '