Fix: Only block clicks on private services that have data-service attribute (modals), allow others to link normally

This commit is contained in:
Roberth Rajala 2026-02-02 13:15:24 +01:00
parent 1554402d76
commit b53ff9c345
1 changed files with 5 additions and 3 deletions

View File

@ -594,20 +594,22 @@ document.addEventListener('DOMContentLoaded', initServiceStatusChecker);
* Service Info Modals
*/
function initServiceModals() {
const privateServices = document.querySelectorAll('.private-service');
// Only handle services that have data-service attribute (not links to dummy pages)
const privateServices = document.querySelectorAll('.private-service[data-service]');
const modals = document.querySelectorAll('.service-modal');
const closeButtons = document.querySelectorAll('.modal-close');
// Open modal when clicking private service
// Open modal when clicking private service that has a modal
privateServices.forEach(service => {
service.addEventListener('click', (e) => {
e.preventDefault();
const serviceName = service.getAttribute('data-service');
const modal = document.getElementById(`modal-${serviceName}`);
if (modal) {
e.preventDefault();
modal.classList.add('active');
document.body.style.overflow = 'hidden';
}
// If no modal exists, let the link work normally
});
});