@bebranded/bb-contents 1.0.65-beta → 1.0.66-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 +23 -12
- 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.66-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.66-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)
|
|
@@ -358,11 +358,19 @@
|
|
|
358
358
|
return;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
// Configuration de l'animation
|
|
362
|
-
const
|
|
363
|
-
|
|
361
|
+
// Configuration de l'animation - Logique Safari-compatible
|
|
362
|
+
const gapSize = parseInt(gap);
|
|
363
|
+
const totalSize = contentSize * 3 + gapSize * 2;
|
|
364
364
|
const step = (parseFloat(speed) * (isVertical ? 1.5 : 0.8)) / 60;
|
|
365
365
|
let isPaused = false;
|
|
366
|
+
|
|
367
|
+
// Position initiale optimisée pour Safari
|
|
368
|
+
let currentPosition;
|
|
369
|
+
if (direction === (isVertical ? 'bottom' : 'right')) {
|
|
370
|
+
currentPosition = -(contentSize + gapSize);
|
|
371
|
+
} else {
|
|
372
|
+
currentPosition = 0;
|
|
373
|
+
}
|
|
366
374
|
|
|
367
375
|
// Ajuster la taille du conteneur
|
|
368
376
|
if (isVertical && !useAutoHeight) {
|
|
@@ -371,24 +379,27 @@
|
|
|
371
379
|
scrollContainer.style.width = totalSize + 'px';
|
|
372
380
|
}
|
|
373
381
|
|
|
374
|
-
// Fonction d'animation
|
|
382
|
+
// Fonction d'animation Safari-compatible
|
|
375
383
|
const animate = () => {
|
|
376
384
|
if (!isPaused) {
|
|
377
385
|
if (direction === (isVertical ? 'bottom' : 'right')) {
|
|
378
386
|
currentPosition += step;
|
|
387
|
+
// Reset Safari-compatible pour direction bottom/right
|
|
379
388
|
if (currentPosition >= 0) {
|
|
380
|
-
currentPosition = -contentSize
|
|
389
|
+
currentPosition = -(contentSize + gapSize);
|
|
381
390
|
}
|
|
382
391
|
} else {
|
|
383
392
|
currentPosition -= step;
|
|
384
|
-
|
|
385
|
-
|
|
393
|
+
// Reset Safari-compatible pour direction top/left
|
|
394
|
+
if (currentPosition <= -(2 * (contentSize + gapSize))) {
|
|
395
|
+
currentPosition = -(contentSize + gapSize);
|
|
386
396
|
}
|
|
387
397
|
}
|
|
388
398
|
|
|
399
|
+
// Transform optimisé pour Safari
|
|
389
400
|
const transform = isVertical
|
|
390
|
-
? `translate3d(
|
|
391
|
-
: `translate3d(${currentPosition}px,
|
|
401
|
+
? `translate3d(0, ${currentPosition}px, 0)`
|
|
402
|
+
: `translate3d(${currentPosition}px, 0, 0)`;
|
|
392
403
|
scrollContainer.style.transform = transform;
|
|
393
404
|
}
|
|
394
405
|
requestAnimationFrame(animate);
|
|
@@ -396,7 +407,7 @@
|
|
|
396
407
|
|
|
397
408
|
// Démarrer l'animation
|
|
398
409
|
animate();
|
|
399
|
-
console.log('✅ [MARQUEE] Animation démarrée avec succès');
|
|
410
|
+
console.log('✅ [MARQUEE] Animation démarrée avec succès (Safari-compatible)');
|
|
400
411
|
|
|
401
412
|
// Pause au survol
|
|
402
413
|
if (pauseOnHover === 'true') {
|