@bebranded/bb-contents 1.0.68-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 +46 -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.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,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,56 @@
|
|
|
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
|
|
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
|
+
}
|
|
420
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;
|
|
421
435
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
// Injecter les keyframes dans le head
|
|
425
|
-
const style = document.createElement('style');
|
|
426
|
-
style.textContent = keyframes;
|
|
427
|
-
document.head.appendChild(style);
|
|
436
|
+
requestAnimationFrame(animate);
|
|
437
|
+
};
|
|
428
438
|
|
|
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');
|
|
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);
|
|
438
444
|
|
|
439
445
|
// Pause au survol pour Safari
|
|
440
446
|
if (element.getAttribute('bb-marquee-pause') === 'true') {
|
|
441
|
-
element.addEventListener('mouseenter', () =>
|
|
442
|
-
|
|
443
|
-
});
|
|
444
|
-
element.addEventListener('mouseleave', () => {
|
|
445
|
-
scrollContainer.style.animationPlayState = 'running';
|
|
446
|
-
});
|
|
447
|
+
element.addEventListener('mouseenter', () => isPaused = true);
|
|
448
|
+
element.addEventListener('mouseleave', () => isPaused = false);
|
|
447
449
|
}
|
|
448
450
|
},
|
|
449
451
|
|