@bebranded/bb-contents 1.0.96 → 1.0.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bb-contents.js +7 -41
  2. package/package.json +1 -1
package/bb-contents.js CHANGED
@@ -389,58 +389,24 @@
389
389
  const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent) ||
390
390
  (window.innerWidth <= 768 && /Chrome|CriOS/i.test(navigator.userAgent));
391
391
 
392
- // OPTIMISATION: Charger les images en respectant le CSS Webflow
392
+ // SOLUTION MOBILE : Laisser les images tranquilles, le CSS Webflow gère mieux
393
393
  images.forEach(img => {
394
- // Préserver les styles CSS existants AVANT toute modification
395
- const computedStyle = getComputedStyle(img);
396
- const originalObjectFit = img.style.objectFit || computedStyle.objectFit;
397
- const originalObjectPosition = img.style.objectPosition || computedStyle.objectPosition;
398
- const originalWidth = computedStyle.width;
399
- const originalHeight = computedStyle.height;
400
-
401
- // OPTIMISATION MOBILE : Améliorer le rendu des images sur mobile (sans transform sur l'image)
402
- if (isMobile) {
403
- // Forcer le rendu haute qualité sur mobile sans transform (évite conflit avec translate3d du parent)
404
- img.style.backfaceVisibility = 'hidden';
405
- img.style.webkitBackfaceVisibility = 'hidden';
406
- // Ne PAS mettre transform sur l'image car le parent utilise translate3d
407
- // Cela évite les problèmes de flou causés par les transformations multiples
408
- img.style.willChange = 'auto'; // Éviter will-change qui peut causer du flou
409
- }
410
-
411
- // Charger l'image si nécessaire
394
+ // Charger l'image si nécessaire, mais ne pas toucher aux styles CSS
395
+ // Le CSS de Webflow est optimisé et on ne veut pas interférer
412
396
  if (img.complete && img.naturalWidth > 0) {
413
- // Image déjà chargée, ne rien toucher
397
+ // Image déjà chargée
414
398
  imagesLoaded++;
415
399
  } else {
416
400
  if (img.dataset.src && !img.src) {
417
401
  img.src = img.dataset.src;
418
402
  }
419
403
 
420
- // OPTIMISATION MOBILE : Utiliser eager sur mobile pour éviter le flou de lazy loading
421
- if (!img.loading) {
422
- img.loading = isMobile ? 'eager' : 'lazy'; // eager sur mobile pour meilleur rendu
404
+ // Utiliser eager sur mobile pour éviter le flou de lazy loading
405
+ if (!img.loading && isMobile) {
406
+ img.loading = 'eager';
423
407
  }
424
408
 
425
409
  img.onload = () => {
426
- // OPTIMISATION: Restaurer les styles CSS après chargement
427
- if (originalObjectFit && originalObjectFit !== 'none') {
428
- img.style.objectFit = originalObjectFit;
429
- }
430
- if (originalObjectPosition && originalObjectPosition !== 'initial') {
431
- img.style.objectPosition = originalObjectPosition;
432
- }
433
-
434
- // OPTIMISATION MOBILE : Respecter les dimensions CSS de Webflow
435
- // Ne PAS forcer auto si les dimensions CSS sont définies dans Webflow
436
- // Le CSS de Webflow prend toujours le dessus
437
-
438
- // Forcer le recalcul pour mobile (important pour le rendu)
439
- if (isMobile) {
440
- // Force reflow pour meilleur rendu sans ajouter de transform
441
- void img.offsetHeight;
442
- }
443
-
444
410
  imagesLoaded++;
445
411
  };
446
412
  img.onerror = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.96",
3
+ "version": "1.0.97",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {