Created
May 25, 2025 20:30
-
-
Save Laerkesophieeeee/d9cd4d1cd21011e38e06972571e47be4 to your computer and use it in GitHub Desktop.
Eksamen pop-up banner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="popup-banner" style="display:none; | |
background-color:#d6d4be; | |
color:#384517; | |
padding:15px 20px; | |
text-align:center; | |
font-family: 'EB Garamond', serif; | |
font-size:20px; | |
position:fixed; | |
bottom:0; | |
left:0; | |
right:0; | |
z-index:9999; | |
box-shadow:0 2px 5px rgba(0,0,0,0.2);"> | |
Dette er et eksamensprojekt <span id="close-popup" style="cursor:pointer; margin-left:15px; font-weight:bold;">✖</span> | |
</div> | |
<script> | |
window.addEventListener('load', function () { | |
// Tjek om pop-up allerede er lukket tidligere i sessionen | |
if (!sessionStorage.getItem('popupClosed')) { | |
document.getElementById('popup-banner').style.display = 'block'; | |
} | |
}); | |
document.addEventListener('DOMContentLoaded', function () { | |
document.getElementById('close-popup').addEventListener('click', function () { | |
document.getElementById('popup-banner').style.display = 'none'; | |
// Gem i sessionStorage at pop-up er lukket | |
sessionStorage.setItem('popupClosed', 'true'); | |
}); | |
}); | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment