@bebranded/bb-contents 1.0.67-beta → 1.0.69-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 +51 -29
- 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.69-beta
|
|
5
5
|
* @author BeBranded
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @website https://www.bebranded.xyz
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
// Configuration
|
|
36
36
|
const config = {
|
|
37
|
-
version: '1.0.
|
|
37
|
+
version: '1.0.69-beta',
|
|
38
38
|
debug: true, // Debug activé pour diagnostic
|
|
39
39
|
prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
|
|
40
40
|
youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
|
|
@@ -382,9 +382,12 @@
|
|
|
382
382
|
initSafariAnimation: function(element, scrollContainer, mainBlock, options) {
|
|
383
383
|
const { speed, direction, gap, isVertical, useAutoHeight, contentSize, gapSize } = options;
|
|
384
384
|
|
|
385
|
-
|
|
385
|
+
console.log(`🔍 [MARQUEE] Safari Animation - direction: ${direction}, isVertical: ${isVertical}, contentSize: ${contentSize}`);
|
|
386
|
+
|
|
387
|
+
// Solution Safari hybride : JavaScript avec optimisations Safari
|
|
386
388
|
const totalSize = contentSize * 3 + gapSize * 2;
|
|
387
|
-
const
|
|
389
|
+
const step = (parseFloat(speed) * (isVertical ? 1.5 : 0.8)) / 60;
|
|
390
|
+
let isPaused = false;
|
|
388
391
|
|
|
389
392
|
// Ajuster la taille du conteneur
|
|
390
393
|
if (isVertical && !useAutoHeight) {
|
|
@@ -393,37 +396,56 @@
|
|
|
393
396
|
scrollContainer.style.width = totalSize + 'px';
|
|
394
397
|
}
|
|
395
398
|
|
|
396
|
-
//
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
transform: ${isVertical ? `translateY(-${contentSize + gapSize}px)` : `translateX(-${contentSize + gapSize}px)`};
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
`;
|
|
399
|
+
// Position initiale optimisée pour Safari
|
|
400
|
+
let currentPosition;
|
|
401
|
+
if (direction === (isVertical ? 'bottom' : 'right')) {
|
|
402
|
+
currentPosition = -(contentSize + gapSize);
|
|
403
|
+
} else {
|
|
404
|
+
currentPosition = 0;
|
|
405
|
+
}
|
|
407
406
|
|
|
408
|
-
//
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
|
|
407
|
+
// Forcer la position initiale pour éviter l'invisibilité
|
|
408
|
+
const initialTransform = isVertical
|
|
409
|
+
? `translate3d(0, ${currentPosition}px, 0)`
|
|
410
|
+
: `translate3d(${currentPosition}px, 0, 0)`;
|
|
411
|
+
scrollContainer.style.transform = initialTransform;
|
|
412
|
+
|
|
413
|
+
console.log(`🔍 [MARQUEE] Safari - Position initiale: ${currentPosition}px, transform: ${initialTransform}`);
|
|
412
414
|
|
|
413
|
-
//
|
|
414
|
-
const
|
|
415
|
-
|
|
415
|
+
// Fonction d'animation Safari optimisée
|
|
416
|
+
const animate = () => {
|
|
417
|
+
if (!isPaused) {
|
|
418
|
+
if (direction === (isVertical ? 'bottom' : 'right')) {
|
|
419
|
+
currentPosition += step;
|
|
420
|
+
if (currentPosition >= 0) {
|
|
421
|
+
currentPosition = -(contentSize + gapSize);
|
|
422
|
+
}
|
|
423
|
+
} else {
|
|
424
|
+
currentPosition -= step;
|
|
425
|
+
if (currentPosition <= -(2 * (contentSize + gapSize))) {
|
|
426
|
+
currentPosition = -(contentSize + gapSize);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// Transform optimisé pour Safari avec will-change
|
|
431
|
+
const transform = isVertical
|
|
432
|
+
? `translate3d(0, ${currentPosition}px, 0)`
|
|
433
|
+
: `translate3d(${currentPosition}px, 0, 0)`;
|
|
434
|
+
scrollContainer.style.transform = transform;
|
|
435
|
+
}
|
|
436
|
+
requestAnimationFrame(animate);
|
|
437
|
+
};
|
|
416
438
|
|
|
417
|
-
|
|
439
|
+
// Démarrer l'animation avec un petit délai pour Safari
|
|
440
|
+
setTimeout(() => {
|
|
441
|
+
animate();
|
|
442
|
+
console.log('✅ [MARQUEE] Animation Safari démarrée avec JavaScript optimisé');
|
|
443
|
+
}, 50);
|
|
418
444
|
|
|
419
445
|
// Pause au survol pour Safari
|
|
420
446
|
if (element.getAttribute('bb-marquee-pause') === 'true') {
|
|
421
|
-
element.addEventListener('mouseenter', () =>
|
|
422
|
-
|
|
423
|
-
});
|
|
424
|
-
element.addEventListener('mouseleave', () => {
|
|
425
|
-
scrollContainer.style.animationPlayState = 'running';
|
|
426
|
-
});
|
|
447
|
+
element.addEventListener('mouseenter', () => isPaused = true);
|
|
448
|
+
element.addEventListener('mouseleave', () => isPaused = false);
|
|
427
449
|
}
|
|
428
450
|
},
|
|
429
451
|
|