@bebranded/bb-contents 1.1.15 → 1.1.16
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 +9 -16
- 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.1.
|
|
4
|
+
* @version 1.1.16
|
|
5
5
|
* @author BeBranded
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @website https://www.bebranded.xyz
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
12
|
// Version du script
|
|
13
|
-
const BB_CONTENTS_VERSION = '1.1.
|
|
13
|
+
const BB_CONTENTS_VERSION = '1.1.16';
|
|
14
14
|
|
|
15
15
|
// Créer l'objet temporaire pour la configuration si il n'existe pas
|
|
16
16
|
if (!window._bbContentsConfig) {
|
|
@@ -298,6 +298,7 @@
|
|
|
298
298
|
},
|
|
299
299
|
|
|
300
300
|
// Active le comportement hover pour les dropdowns dans un bloc du marquee (portal hors scrollContainer pour éviter le clipping)
|
|
301
|
+
// Respecte le design Webflow : position au-dessus du logo, pas de surcharge de styles, pas de latence.
|
|
301
302
|
_enableMarqueeDropdowns: function(block) {
|
|
302
303
|
if (!block || !block.querySelectorAll) return;
|
|
303
304
|
const items = block.querySelectorAll('.bb-marquee_item, [role="listitem"]');
|
|
@@ -310,7 +311,6 @@
|
|
|
310
311
|
if (!list || !toggle) return;
|
|
311
312
|
item.style.overflow = 'visible';
|
|
312
313
|
dropdown.style.overflow = 'visible';
|
|
313
|
-
let leaveTimer;
|
|
314
314
|
let portalWrapper = null;
|
|
315
315
|
|
|
316
316
|
function closePortal() {
|
|
@@ -322,24 +322,16 @@
|
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
function openPortal() {
|
|
325
|
-
clearTimeout(leaveTimer);
|
|
326
325
|
if (portalWrapper && portalWrapper.parentNode) return;
|
|
327
326
|
const rect = toggle.getBoundingClientRect();
|
|
328
327
|
portalWrapper = document.createElement('div');
|
|
329
328
|
portalWrapper.setAttribute('data-bb-marquee-dropdown-portal', 'true');
|
|
330
|
-
portalWrapper.style.cssText = 'position:fixed;left:' + rect.left + 'px;top:' +
|
|
329
|
+
portalWrapper.style.cssText = 'position:fixed;left:' + rect.left + 'px;top:' + rect.top + 'px;transform:translateY(-100%);margin-top:-4px;z-index:9999;';
|
|
331
330
|
const clone = list.cloneNode(true);
|
|
332
331
|
clone.style.display = 'block';
|
|
333
|
-
clone.style.visibility = 'visible';
|
|
334
|
-
clone.style.opacity = '1';
|
|
335
|
-
clone.style.position = 'absolute';
|
|
336
|
-
clone.style.left = '0';
|
|
337
|
-
clone.style.top = '0';
|
|
338
332
|
portalWrapper.appendChild(clone);
|
|
339
|
-
portalWrapper.addEventListener('mouseenter', function() {
|
|
340
|
-
portalWrapper.addEventListener('mouseleave', function() {
|
|
341
|
-
leaveTimer = setTimeout(closePortal, 150);
|
|
342
|
-
});
|
|
333
|
+
portalWrapper.addEventListener('mouseenter', function() {});
|
|
334
|
+
portalWrapper.addEventListener('mouseleave', function() { closePortal(); });
|
|
343
335
|
document.body.appendChild(portalWrapper);
|
|
344
336
|
dropdown.classList.add('w--open');
|
|
345
337
|
}
|
|
@@ -347,8 +339,9 @@
|
|
|
347
339
|
dropdown.addEventListener('mouseenter', function() {
|
|
348
340
|
openPortal();
|
|
349
341
|
});
|
|
350
|
-
dropdown.addEventListener('mouseleave', function() {
|
|
351
|
-
|
|
342
|
+
dropdown.addEventListener('mouseleave', function(e) {
|
|
343
|
+
if (portalWrapper && e.relatedTarget && portalWrapper.contains(e.relatedTarget)) return;
|
|
344
|
+
closePortal();
|
|
352
345
|
});
|
|
353
346
|
});
|
|
354
347
|
});
|