0 Commentaires
0 Parts
38 Vue
document.addEventListener("DOMContentLoaded", function() { document.fonts.ready.then(() => { document.body.classList.add("fonts-loaded"); }); }); function supportsWebP() { return new Promise(resolve => { const img = new Image(); img.onload = () => resolve(img.width === 1); img.onerror = () => resolve(false); img.src = "data:image/webp;base64,UklGRhYAAABXRUJQVlA4TAYAAAAvAAAAAA..."; }); } supportsWebP().then(isSupported => { if (!isSupported) { const images = document.querySelectorAll('img[data-fallback]'); images.forEach(img => { img.src = img.dataset.fallback; }); } });