webinar

de webinar test. !important × Gratis (jong) talent in je inbox! AANMELDEN Door op ‘aanmelden’ te

de webinar test.

!important // Wrap everything in a self-executing function to avoid global conflicts (function() { 'use strict'; // Use a unique namespace to avoid conflicts var MyModalNamespace = { modalShown: false, autoTimer: null, // Show modal function showModal: function() { var modal = document.getElementById('myUniqueModal_2024'); if (modal && !this.modalShown) { modal.style.display = 'flex'; this.modalShown = true; // Prevent body scroll var originalOverflow = document.body.style.overflow; document.body.style.overflow = 'hidden'; // Store original value to restore later modal.setAttribute('data-original-overflow', originalOverflow); } }, // Hide modal function hideModal: function() { var modal = document.getElementById('myUniqueModal_2024'); if (modal) { modal.style.display = 'none'; // Restore body scroll var originalOverflow = modal.getAttribute('data-original-overflow') || ''; document.body.style.overflow = originalOverflow; } }, // Form submit handler handleSubmit: function(event) { event.preventDefault(); var form = event.target; var formData = new FormData(form); var name = formData.get('name'); var email = formData.get('email'); // Email validation var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if (!emailRegex.test(email)) { alert('Voer een geldig e-mailadres in.'); return false; } // Success message alert('Bedankt voor je aanmelding, ' + name + '!'); // Clear form and close modal form.reset(); this.hideModal(); return false; }, // Initialize everything init: function() { var self = this; // Show decorative image on larger screens if (window.innerWidth > 600) { var decorImg = document.getElementById('modalDecoImg'); if (decorImg) { decorImg.style.display = 'block'; } } // Auto-show after delay (currently 3 seconds for testing) this.autoTimer = setTimeout(function() { if (!self.modalShown) { self.showModal(); } }, 3000); // Event listeners document.addEventListener('keydown', function(e) { if (e.key === 'Escape' || e.keyCode === 27) { self.hideModal(); } }); // Click outside to close var modal = document.getElementById('myUniqueModal_2024'); if (modal) { modal.addEventListener('click', function(e) { if (e.target === modal) { self.hideModal(); } }); } // Cleanup on page unload window.addEventListener('beforeunload', function() { if (self.autoTimer) { clearTimeout(self.autoTimer); } }); } }; // Make functions globally available for onclick handlers window.showMyModal = function() { MyModalNamespace.showModal(); }; window.hideMyModal = function() { MyModalNamespace.hideModal(); }; window.handleMyFormSubmit = function(event) { return MyModalNamespace.handleSubmit(event); }; // Initialize when DOM is ready - try multiple methods to ensure it works function initWhenReady() { if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function() { MyModalNamespace.init(); }); } else { MyModalNamespace.init(); } } // Also try window.onload as backup if (window.addEventListener) { window.addEventListener('load', function() { if (!MyModalNamespace.modalShown) { MyModalNamespace.init(); } }); } // Start initialization initWhenReady(); })(); /* Additional CSS to override potential conflicts */ #myUniqueModal_2024 * { box-sizing: border-box !important; margin: 0; padding: 0; } #myUniqueModal_2024 input:focus { outline: none !important; border-color: #ff5722 !important; box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.1) !important; } #myUniqueModal_2024 button:hover { transform: translateY(-2px) !important; box-shadow: 0 8px 20px rgba(255, 87, 34, 0.3) !important; } /* Mobile responsive */ @media (max-width: 600px) { #myUniqueModal_2024 > div { padding: 30px 25px !important; margin: 20px !important; } #myUniqueModal_2024 > div > div { flex-direction: column !important; gap: 20px !important; } #myUniqueModal_2024 h2 { font-size: 24px !important; } } setTimeout(function() { // All the modal code here }, 5000); // Wait 5 seconds for other scripts to load