@bebranded/bb-contents 1.0.136 → 1.0.137

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 +47 -7
  2. package/package.json +1 -1
package/bb-contents.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * BeBranded Contents
3
3
  * Contenus additionnels français pour Webflow
4
- * @version 1.0.136
4
+ * @version 1.0.137
5
5
  * @author BeBranded
6
6
  * @license MIT
7
7
  * @website https://www.bebranded.xyz
@@ -32,11 +32,11 @@
32
32
  window._bbContentsInitialized = true;
33
33
 
34
34
  // Log de démarrage simple (une seule fois)
35
- console.log('bb-contents | v1.0.136');
35
+ console.log('bb-contents | v1.0.137');
36
36
 
37
37
  // Configuration
38
38
  const config = {
39
- version: '1.0.136',
39
+ version: '1.0.137',
40
40
  debug: false, // Debug désactivé pour rendu propre
41
41
  prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
42
42
  youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
@@ -394,10 +394,50 @@
394
394
  const repeatBlock1 = mainBlock.cloneNode(true);
395
395
  const repeatBlock2 = mainBlock.cloneNode(true);
396
396
 
397
- scrollContainer.appendChild(mainBlock);
398
- scrollContainer.appendChild(repeatBlock1);
399
- scrollContainer.appendChild(repeatBlock2);
400
- mainContainer.appendChild(scrollContainer);
397
+ // Pour les marquees horizontaux, calculer la hauteur avant de mettre en absolute
398
+ if (!isVertical) {
399
+ // Temporairement mettre scrollContainer en relative pour calculer la hauteur
400
+ scrollContainer.style.position = 'relative';
401
+ scrollContainer.appendChild(mainBlock);
402
+ scrollContainer.appendChild(repeatBlock1);
403
+ scrollContainer.appendChild(repeatBlock2);
404
+ mainContainer.appendChild(scrollContainer);
405
+
406
+ // Forcer un reflow pour calculer les dimensions
407
+ void scrollContainer.offsetHeight;
408
+
409
+ // Calculer la hauteur maximale des items
410
+ const items = mainBlock.querySelectorAll('.bb-marquee_item, [role="listitem"], > *');
411
+ let maxHeight = 0;
412
+ items.forEach(function(item) {
413
+ const itemHeight = item.offsetHeight;
414
+ if (itemHeight > maxHeight) {
415
+ maxHeight = itemHeight;
416
+ }
417
+ });
418
+
419
+ // Si aucun item trouvé, essayer de prendre la hauteur du scrollContainer
420
+ if (maxHeight === 0) {
421
+ maxHeight = scrollContainer.offsetHeight;
422
+ }
423
+
424
+ // Appliquer la hauteur calculée au mainContainer si elle est valide
425
+ if (maxHeight > 0) {
426
+ mainContainer.style.height = maxHeight + 'px';
427
+ }
428
+
429
+ // Maintenant mettre scrollContainer en absolute
430
+ scrollContainer.style.position = 'absolute';
431
+ scrollContainer.style.height = '100%';
432
+ scrollContainer.style.top = '0px';
433
+ scrollContainer.style.left = '0px';
434
+ } else {
435
+ // Pour vertical, garder le comportement actuel
436
+ scrollContainer.appendChild(mainBlock);
437
+ scrollContainer.appendChild(repeatBlock1);
438
+ scrollContainer.appendChild(repeatBlock2);
439
+ mainContainer.appendChild(scrollContainer);
440
+ }
401
441
 
402
442
  element.innerHTML = '';
403
443
  element.appendChild(mainContainer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.136",
3
+ "version": "1.0.137",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {