|
|
|
|
|
|
|
|
function initializeModal() { |
|
|
const modal = document.getElementById('instructionsModal'); |
|
|
const helpBtn = document.getElementById('helpBtn'); |
|
|
const closeBtn = document.querySelector('.close'); |
|
|
|
|
|
if (!modal || !helpBtn || !closeBtn) return; |
|
|
|
|
|
|
|
|
helpBtn.addEventListener('click', function() { |
|
|
modal.style.display = 'block'; |
|
|
document.body.style.overflow = 'hidden'; |
|
|
}); |
|
|
|
|
|
|
|
|
closeBtn.addEventListener('click', function() { |
|
|
modal.style.display = 'none'; |
|
|
document.body.style.overflow = 'auto'; |
|
|
}); |
|
|
|
|
|
|
|
|
window.addEventListener('click', function(event) { |
|
|
if (event.target === modal) { |
|
|
modal.style.display = 'none'; |
|
|
document.body.style.overflow = 'auto'; |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
document.addEventListener('keydown', function(event) { |
|
|
if (event.key === 'Escape' && modal.style.display === 'block') { |
|
|
modal.style.display = 'none'; |
|
|
document.body.style.overflow = 'auto'; |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
window.initializeModal = initializeModal; |
|
|
|