// Modern version of app.js using ES modules document.addEventListener('DOMContentLoaded', () => { if (window.jQuery) { initializeApp(jQuery); } else { const checkJQuery = () => { if (window.jQuery) { initializeApp(jQuery); } else { setTimeout(checkJQuery, 50); } }; checkJQuery(); } }); function initializeApp($) { // Initialize modals $('.modal-trigger').click(function() { const target = $(this).data('target'); $(`#${target}`).addClass('show'); $('body').addClass('modal-open'); }); // Close modals $('.modal-close').click(function() { $(this).closest('.modal').removeClass('show'); $('body').removeClass('modal-open'); }); // Initialize tooltips $('[data-toggle="tooltip"]').each(function() { const placement = $(this).data('placement') || 'top'; $(this).tooltip({ placement, trigger: 'hover' }); }); // Smooth scrolling for anchor links $('a[href^="#"]').on('click', function(e) { const target = $(this.getAttribute('href')); if (target.length) { e.preventDefault(); $('html, body').animate({ scrollTop: target.offset().top - 100 }, 500); } }); }