Dave and Co Metals - Header
Premium Bullion • Limited-Time Savings • Apply DAVE78 and save 5 TO 10% today.

2022 1 oz Proof Canadian Silver Best Wishes on Your Wedding Day Coin (Box)

Showing the single result

Shopping Cart
/* ======================================== DAVE AND CO METALS - MOBILE FIX JAVASCRIPT Fixes responsive images and layout issues ======================================== */(function() { 'use strict';// FIX 1: FORCE RESPONSIVE IMAGES function fixImages() { const images = document.querySelectorAll('img'); images.forEach(img => { if (img.style.width && img.style.width !== '100%') { img.style.width = '100%'; img.style.height = 'auto'; img.style.maxWidth = '100%'; img.style.display = 'block'; } if (!img.style.maxWidth) { img.style.maxWidth = '100%'; img.style.height = 'auto'; } }); }// FIX 2: FORCE CONTAINERS TO BE RESPONSIVE function fixContainers() { const containers = document.querySelectorAll( '.elementor-container, .container, .wp-container, [class*="container"]' ); containers.forEach(container => { container.style.maxWidth = '100%'; container.style.width = '100%'; container.style.overflowX = 'hidden'; }); }// FIX 3: FORCE SECTIONS TO BE FULL WIDTH function fixSections() { const sections = document.querySelectorAll( '.elementor-section, section, [class*="section"]' ); sections.forEach(section => { section.style.width = '100%'; section.style.maxWidth = '100%'; section.style.overflowX = 'hidden'; }); }// FIX 4: STACK PRODUCT GRIDS ON MOBILE function fixProductGrids() { const gridItems = document.querySelectorAll( '.woocommerce ul.products li, .product-item, [class*="product"][class*="grid"], [class*="grid"][class*="product"]' );if (window.innerWidth <= 768) { gridItems.forEach(item => { item.style.width = '100%'; item.style.minWidth = 'unset'; item.style.maxWidth = '100%'; item.style.marginRight = '0'; item.style.marginBottom = '20px'; }); } }// FIX 5: REMOVE INLINE WIDTHS THAT BREAK LAYOUT function removeInlineWidths() { const elements = document.querySelectorAll('[style*="width"]'); elements.forEach(el => { const style = el.getAttribute('style');// Check for problematic fixed widths if (style && ( style.includes('width: 1200px') || style.includes('width: 1000px') || style.includes('width: 900px') || style.includes('width: 800px') || style.includes('width: 750px') )) { // Remove the fixed width const newStyle = style .replace(/width:\s*\d+px\s*!important;?/gi, '') .replace(/width:\s*\d+px;?/gi, '');if (newStyle.trim()) { el.setAttribute('style', newStyle); } else { el.removeAttribute('style'); } } }); }// FIX 6: PREVENT HORIZONTAL OVERFLOW function preventOverflow() { document.documentElement.style.overflowX = 'hidden'; document.body.style.overflowX = 'hidden'; document.body.style.width = '100%'; document.body.style.maxWidth = '100%'; }// FIX 7: FIX ELEMENTOR WIDGET WIDTHS function fixElementorWidgets() { const widgets = document.querySelectorAll('.elementor-widget, .elementor-column'); widgets.forEach(widget => { if (widget.style.width && widget.style.width !== '100%') { widget.style.width = '100%'; widget.style.maxWidth = '100%'; } }); }// FIX 8: MAKE IMAGES LAZY LOAD PROPERLY function enableLazyLoading() { const images = document.querySelectorAll('img:not([loading])'); images.forEach(img => { img.loading = 'lazy'; }); }// FIX 9: RESPONSIVE BACKGROUND IMAGES function fixBackgroundImages() { const elements = document.querySelectorAll('[style*="background-image"]'); elements.forEach(el => { el.style.backgroundSize = 'cover'; el.style.backgroundPosition = 'center'; el.style.backgroundAttachment = 'scroll'; }); }// FIX 10: HANDLE WINDOW RESIZE function handleResize() { if (window.innerWidth <= 768) { fixImages(); fixContainers(); fixSections(); fixProductGrids(); fixElementorWidgets(); } }// MAIN INIT FUNCTION function init() { // Run fixes immediately preventOverflow(); fixImages(); fixContainers(); fixSections(); fixProductGrids(); removeInlineWidths(); fixElementorWidgets(); enableLazyLoading(); fixBackgroundImages();// Listen for window resize window.addEventListener('resize', handleResize);// Re-run when DOM changes (for dynamically loaded content) const observer = new MutationObserver(() => { if (window.innerWidth <= 768) { fixImages(); fixProductGrids(); } });observer.observe(document.body, { childList: true, subtree: true }); }// Run on document ready if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); }// Also run after a slight delay to catch Elementor rendering setTimeout(init, 500); setTimeout(init, 1000); })();/* END OF MOBILE FIX JAVASCRIPT */