Compare commits

..

2 Commits

Author SHA1 Message Date
6b9c0f7d22 Close popup when clicking outside
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2026-03-02 09:36:10 +00:00
e9c575ab88 Fix popup
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2026-03-02 08:30:19 +00:00

View File

@@ -45,7 +45,7 @@
.modal { .modal {
display: none; display: none;
position: absolute; position: fixed;
top: 25%; top: 25%;
left: 25%; left: 25%;
height: 430px; height: 430px;
@@ -243,6 +243,23 @@
{{ end }} {{ end }}
</main> </main>
<script> <script>
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
document.querySelectorAll('.modal.show').forEach(modal => {
modal.classList.remove('show');
});
}
});
document.addEventListener('click', function(event) {
const modal = event.target.closest('.modal');
if (!modal && document.querySelectorAll('.modal.show').length > 0 && !event.target.closest('.more-link')) {
document.querySelectorAll('.modal.show').forEach(modal => {
modal.classList.remove('show');
});
}
});
[...document.querySelectorAll('.more-link')].forEach(more => { [...document.querySelectorAll('.more-link')].forEach(more => {
const toggleModal = function(event) { const toggleModal = function(event) {
event.preventDefault(); event.preventDefault();