Ervaar de naadloze zorg van MedEx — 10% korting op uw eerste afspraak - Gebruik de kortingscode 'TRYMEDEX' bij het afrekenen ///////////////////////////////////// Algemene prijslijst — Consultatie: 750 THB | Kosten voor thuistest: 750 THB (GRATIS bij bestellingen boven 5.000 THB)
`; $('#subtotal').parent().after(iconContainer); const self = this; // Bind print event (CSS wordt verborgen op mobiel) $('#print-cart-btn').on('click', function() { self.printCart.call(self); }); $('#copy-cart-btn').on('click', function() { self.copyCartAsBulletList.call(self); }); }; LabDOSApp.originalRenderCart = LabDOSApp.renderCart; LabDOSApp.renderCart = function(highlightItemName = null) { this.originalRenderCart.call(this, highlightItemName); this.addCartIcons.call(this); }; $(document).ready(function() { setTimeout(function() { if (LabDOSApp && typeof LabDOSApp.addCartIcons === 'function') { LabDOSApp.addCartIcons.call(LabDOSApp); } }, 1000); // Nieuw: Schakel de labdos-inview-klasse in/uit en behandel het sticky zoekvak (function(){ var rootEl = document.getElementById('lab-dos'); if (!rootEl) return; function setInView(inView){ document.body.classList.toggle('labdos-inview', !!inView); console.log('labdos-inview:', inView); // Debug } function recompute() { var rect = rootEl.getBoundingClientRect(); var vpH = window.innerHeight || document.documentElement.clientHeight; // Beschouw in-view als significant een deel van #lab-dos is zichtbaar var inView = rect.bottom > vpH * 0.2 && rect.top < vpH * 0.8; setInView(inView); } if ('IntersectionObserver' in window) { try { var io = new IntersectionObserver(function(entries){ entries.forEach(function(entry){ setInView(entry.isIntersecting); }); }, { threshold: [0, 0.01], rootMargin: '0px 0px -30% 0px' }); io.observe(rootEl); } catch(e) { /* terugvallen op scrollcontroles */ } } $(window).on('scroll.labdos resize.labdos orientationchange.labdos', recompute); setTimeout(recompute, 100); })(); // Forceer een sticky zoekvak op mobiel met een agressieve aanpak (function(){ console.log('Initializing sticky search box'); // Debug var $searchBox = $('#lab-dos .search-box'); var $searchWrapper = $('#lab-dos .search-wrapper'); console.log('Found elements:', $searchBox.length, $searchWrapper.length); // Debug if (!$searchBox.length || !$searchWrapper.length) return; var stickyClone = null; var isStuck = false; function handleSticky() { var isMobile = window.innerWidth <= 991; if (!isMobile) { if (isStuck) unstickSearchBox(); return; } if (!document.body.classList.contains('labdos-inview')) { if (isStuck) unstickSearchBox(); return; } var searchRect = $searchBox[0].getBoundingClientRect(); var shouldStick = searchRect.top <= 60; console.log('Sticky check:', { shouldStick, searchTop: searchRect.top, isStuck }); // Debug if (shouldStick && !isStuck) { stickSearchBox(); } else if (!shouldStick && isStuck) { unstickSearchBox(); } } function stickSearchBox() { if (isStuck) return; isStuck = true; console.log('ACTIVATING sticky search box'); // Debug // Create a simple anchor-style sticky search stickyClone = $(''); stickyClone.html(`
Tik om laboratoriumtests te zoeken...
`); stickyClone.css({ position: 'fixed', top: '60px', left: '15px', right: '15px', height: '50px', zIndex: '99999', backgroundColor: 'rgba(255, 255, 255, 0.95)', backdropFilter: 'blur(15px)', webkitBackdropFilter: 'blur(15px)', border: '1px solid rgba(255, 76, 136, 0.2)', boxShadow: '0 8px 32px rgba(255, 76, 136, 0.15)', borderRadius: '16px', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#6a297a', fontSize: '16px', fontWeight: '500' }); // Wanneer erop geklikt wordt, scroll naar de originele zoekopdracht en focus stickyClone.on('click', function(){ $('html, body').animate({ scrollTop: Math.max(0, $searchBox.offset().top - 100) }, 400, function(){ $searchBox.find('#searchBox').focus(); }); }); $('body').append(stickyClone); // Voeg spacer toe $searchWrapper.css('paddingTop', '70px'); } function unstickSearchBox() { if (!isStuck) return; isStuck = false; console.log('Deactiveren van sticky search box'); // Debug if (stickyClone) { stickyClone.remove(); stickyClone = null; } $searchWrapper.css('paddingTop', ''); } $(window).on('scroll.sticky resize.sticky orientationchange.sticky', handleSticky); setTimeout(handleSticky, 500); })(); // Initialiseer de zichtbaarheid van de wisknop (×) bij het laden van de pagina var $sb = $('#searchBox'); $sb.closest('.search-box').toggleClass('has-value', ($sb.val() || '').trim().length > 0); // Na 10 seconden, verplaats Gravity Form (id=3) naar de placeholder en toon deze setTimeout(function() { var $placeholder = $('#gravityform-placeholder'); if (!$placeholder.length) return; var $gf = $('#gform_wrapper_3'); if (!$gf.length) { $gf = $('#gform_3').closest('.gform_wrapper'); } if (!$gf.length) { $gf = $('.gform_wrapper').filter(function(){ return $(this).find('#gform_3').length > 0; }).first(); } if ($gf.length) { $gf.hide(); $placeholder.append($gf); $gf.fadeIn(300); } }, 10000); // Laad de Google Maps API pas wanneer de gebruiker interactie heeft met het formulier/de sectie (function(){ var mapsSrc = null; var mapsInjected = false; function captureAndRemoveMapsScript() { if (window.google && window.google.maps) { mapsInjected = true; // Al geladen return; } var $scripts = $('script[src*="maps.googleapis.com/maps/api/js"]'); if ($scripts.length) { mapsSrc = $scripts.eq(0).attr('src'); // Verwijder alle overeenkomende scripts om direct laden te voorkomen $scripts.remove(); } } function injectMapsScriptOnce() { if (mapsInjected) return; mapsInjected = true; if (!mapsSrc) return; var s = document.createElement('script'); s.src = mapsSrc; s.async = true; s.defer = true; document.head.appendChild(s); } // Probeer scripttags zo snel mogelijk vast te leggen captureAndRemoveMapsScript(); // Laad bij interactie met het afrekengedeelte of een invoerveld in het formulier var interactionEvents = 'click focus touchstart change'; $(document).on(interactionEvents, '#checkout-section, #gform_wrapper_3, #gform_3, #gravityform-placeholder', function(){ injectMapsScriptOnce(); }); // Laad wanneer het gedeelte zich in de buurt van de viewport bevindt if ('IntersectionObserver' in window) { var observer = new IntersectionObserver(function(entries){ entries.forEach(function(entry){ if (entry.isIntersecting) { injectMapsScriptOnce(); observer.disconnect(); } }); }, { rootMargin: '200px' }); var el = document.getElementById('checkout-section'); if (el) observer.observe(el); } })(); }); })(jQuery);