@bebranded/bb-contents 1.0.68-beta → 1.0.70-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 +48 -44
- 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.70-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.70-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,11 +382,12 @@
|
|
|
382
382
|
initSafariAnimation: function(element, scrollContainer, mainBlock, options) {
|
|
383
383
|
const { speed, direction, gap, isVertical, useAutoHeight, contentSize, gapSize } = options;
|
|
384
384
|
|
|
385
|
-
console.log(`🔍 [MARQUEE] Safari Animation - direction: ${direction}, isVertical: ${isVertical}`);
|
|
385
|
+
console.log(`🔍 [MARQUEE] Safari Animation - direction: ${direction}, isVertical: ${isVertical}, contentSize: ${contentSize}`);
|
|
386
386
|
|
|
387
|
-
//
|
|
387
|
+
// Solution Safari hybride : JavaScript avec optimisations Safari
|
|
388
388
|
const totalSize = contentSize * 3 + gapSize * 2;
|
|
389
|
-
const
|
|
389
|
+
const step = (parseFloat(speed) * (isVertical ? 1.5 : 0.8)) / 60;
|
|
390
|
+
let isPaused = false;
|
|
390
391
|
|
|
391
392
|
// Ajuster la taille du conteneur
|
|
392
393
|
if (isVertical && !useAutoHeight) {
|
|
@@ -395,55 +396,58 @@
|
|
|
395
396
|
scrollContainer.style.width = totalSize + 'px';
|
|
396
397
|
}
|
|
397
398
|
|
|
398
|
-
//
|
|
399
|
-
let
|
|
400
|
-
const moveDistance = contentSize + gapSize;
|
|
401
|
-
|
|
399
|
+
// Position initiale optimisée pour Safari
|
|
400
|
+
let currentPosition;
|
|
402
401
|
if (direction === (isVertical ? 'bottom' : 'right')) {
|
|
403
|
-
|
|
404
|
-
startPos = isVertical ? `translateY(${moveDistance}px)` : `translateX(${moveDistance}px)`;
|
|
405
|
-
endPos = isVertical ? 'translateY(0px)' : 'translateX(0px)';
|
|
402
|
+
currentPosition = -(contentSize + gapSize);
|
|
406
403
|
} else {
|
|
407
|
-
|
|
408
|
-
startPos = isVertical ? 'translateY(0px)' : 'translateX(0px)';
|
|
409
|
-
endPos = isVertical ? `translateY(-${moveDistance}px)` : `translateX(-${moveDistance}px)`;
|
|
404
|
+
currentPosition = 0;
|
|
410
405
|
}
|
|
411
406
|
|
|
412
|
-
//
|
|
413
|
-
const
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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}`);
|
|
414
|
+
|
|
415
|
+
// Fonction d'animation Safari optimisée avec logique de reset corrigée
|
|
416
|
+
const animate = () => {
|
|
417
|
+
if (!isPaused) {
|
|
418
|
+
if (direction === (isVertical ? 'bottom' : 'right')) {
|
|
419
|
+
currentPosition += step;
|
|
420
|
+
// Reset Safari pour direction bottom/right - logique 3 copies
|
|
421
|
+
if (currentPosition >= 0) {
|
|
422
|
+
currentPosition = -(contentSize + gapSize);
|
|
423
|
+
}
|
|
424
|
+
} else {
|
|
425
|
+
currentPosition -= step;
|
|
426
|
+
// Reset Safari pour direction top/left - logique 3 copies corrigée
|
|
427
|
+
if (currentPosition <= -(contentSize + gapSize)) {
|
|
428
|
+
currentPosition = 0;
|
|
429
|
+
}
|
|
420
430
|
}
|
|
431
|
+
|
|
432
|
+
// Transform optimisé pour Safari
|
|
433
|
+
const transform = isVertical
|
|
434
|
+
? `translate3d(0, ${currentPosition}px, 0)`
|
|
435
|
+
: `translate3d(${currentPosition}px, 0, 0)`;
|
|
436
|
+
scrollContainer.style.transform = transform;
|
|
421
437
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
// Injecter les keyframes dans le head
|
|
425
|
-
const style = document.createElement('style');
|
|
426
|
-
style.textContent = keyframes;
|
|
427
|
-
document.head.appendChild(style);
|
|
438
|
+
requestAnimationFrame(animate);
|
|
439
|
+
};
|
|
428
440
|
|
|
429
|
-
//
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
scrollContainer.style.animation = `${animationName} ${duration}s linear infinite`;
|
|
435
|
-
|
|
436
|
-
console.log(`🔍 [MARQUEE] Safari - duration: ${duration}s, moveDistance: ${moveDistance}px`);
|
|
437
|
-
console.log('✅ [MARQUEE] Animation Safari démarrée avec keyframes CSS');
|
|
441
|
+
// Démarrer l'animation avec un petit délai pour Safari
|
|
442
|
+
setTimeout(() => {
|
|
443
|
+
animate();
|
|
444
|
+
console.log('✅ [MARQUEE] Animation Safari démarrée avec JavaScript optimisé');
|
|
445
|
+
}, 50);
|
|
438
446
|
|
|
439
447
|
// Pause au survol pour Safari
|
|
440
448
|
if (element.getAttribute('bb-marquee-pause') === 'true') {
|
|
441
|
-
element.addEventListener('mouseenter', () =>
|
|
442
|
-
|
|
443
|
-
});
|
|
444
|
-
element.addEventListener('mouseleave', () => {
|
|
445
|
-
scrollContainer.style.animationPlayState = 'running';
|
|
446
|
-
});
|
|
449
|
+
element.addEventListener('mouseenter', () => isPaused = true);
|
|
450
|
+
element.addEventListener('mouseleave', () => isPaused = false);
|
|
447
451
|
}
|
|
448
452
|
},
|
|
449
453
|
|