@bebranded/bb-contents 1.0.24-beta → 1.0.26-beta
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.
- package/bb-contents.js +33 -33
- 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.
|
|
4
|
+
* @version 1.0.26-beta
|
|
5
5
|
* @author BeBranded
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @website https://www.bebranded.xyz
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
// Configuration
|
|
19
19
|
const config = {
|
|
20
|
-
version: '1.0.
|
|
20
|
+
version: '1.0.26-beta',
|
|
21
21
|
debug: window.location.hostname === 'localhost' || window.location.hostname.includes('webflow.io'),
|
|
22
22
|
prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
|
|
23
23
|
i18n: {
|
|
@@ -465,47 +465,47 @@
|
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
467
|
} else {
|
|
468
|
-
// Animation
|
|
468
|
+
// Animation JavaScript pour l'horizontal (comme le vertical pour éviter les saccades)
|
|
469
469
|
const contentSize = contentWidth;
|
|
470
|
-
const totalSize = contentSize * 4 + parseInt(gap) * 3;
|
|
470
|
+
const totalSize = contentSize * 4 + parseInt(gap) * 3;
|
|
471
471
|
scrollContainer.style.width = totalSize + 'px';
|
|
472
472
|
|
|
473
|
-
|
|
474
|
-
const
|
|
475
|
-
|
|
473
|
+
let currentPosition = direction === 'right' ? -contentSize - parseInt(gap) : 0;
|
|
474
|
+
const step = (parseFloat(speed) * 0.5) / 60; // Vitesse réduite pour l'horizontal
|
|
475
|
+
let isPaused = false;
|
|
476
476
|
|
|
477
|
-
//
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
//
|
|
498
|
-
|
|
477
|
+
// Fonction d'animation JavaScript
|
|
478
|
+
const animate = () => {
|
|
479
|
+
if (!isPaused) {
|
|
480
|
+
if (direction === 'right') {
|
|
481
|
+
currentPosition += step;
|
|
482
|
+
if (currentPosition >= 0) {
|
|
483
|
+
currentPosition = -contentSize - parseInt(gap);
|
|
484
|
+
}
|
|
485
|
+
} else {
|
|
486
|
+
currentPosition -= step;
|
|
487
|
+
if (currentPosition <= -contentSize - parseInt(gap)) {
|
|
488
|
+
currentPosition = 0;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
scrollContainer.style.transform = `translate3d(${currentPosition}px, 0px, 0px)`;
|
|
493
|
+
}
|
|
494
|
+
requestAnimationFrame(animate);
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
// Démarrer l'animation
|
|
498
|
+
animate();
|
|
499
|
+
|
|
500
|
+
bbContents.utils.log('Marquee horizontal créé avec animation JS - direction:', direction, 'taille:', contentSize + 'px', 'total:', totalSize + 'px');
|
|
499
501
|
|
|
500
|
-
bbContents.utils.log('Marquee horizontal créé:', animationName, 'durée:', animationDuration + 's', 'direction:', direction, 'taille:', contentSize + 'px', 'total:', totalSize + 'px');
|
|
501
|
-
|
|
502
502
|
// Pause au survol
|
|
503
503
|
if (pauseOnHover === 'true') {
|
|
504
504
|
element.addEventListener('mouseenter', function() {
|
|
505
|
-
|
|
505
|
+
isPaused = true;
|
|
506
506
|
});
|
|
507
507
|
element.addEventListener('mouseleave', function() {
|
|
508
|
-
|
|
508
|
+
isPaused = false;
|
|
509
509
|
});
|
|
510
510
|
}
|
|
511
511
|
}
|