@bebranded/bb-contents 1.1.16 → 1.1.17
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 +11 -36
- 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.17
|
|
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.17';
|
|
14
14
|
|
|
15
15
|
// Créer l'objet temporaire pour la configuration si il n'existe pas
|
|
16
16
|
if (!window._bbContentsConfig) {
|
|
@@ -297,8 +297,7 @@
|
|
|
297
297
|
block.querySelector('[class*="dropdown"]') !== null;
|
|
298
298
|
},
|
|
299
299
|
|
|
300
|
-
// Active le comportement hover pour les dropdowns dans un bloc du marquee (
|
|
301
|
-
// Respecte le design Webflow : position au-dessus du logo, pas de surcharge de styles, pas de latence.
|
|
300
|
+
// Active le comportement hover pour les dropdowns dans un bloc du marquee (w--open uniquement, position et styles 100 % Webflow)
|
|
302
301
|
_enableMarqueeDropdowns: function(block) {
|
|
303
302
|
if (!block || !block.querySelectorAll) return;
|
|
304
303
|
const items = block.querySelectorAll('.bb-marquee_item, [role="listitem"]');
|
|
@@ -307,41 +306,14 @@
|
|
|
307
306
|
const dropdowns = item.querySelectorAll('.w-dropdown, [class*="dropdown"]');
|
|
308
307
|
dropdowns.forEach(function(dropdown) {
|
|
309
308
|
const list = dropdown.querySelector('.w-dropdown-list, [class*="dropdown-list"], [class*="dropdown_list"]');
|
|
310
|
-
|
|
311
|
-
if (!list || !toggle) return;
|
|
309
|
+
if (!list) return;
|
|
312
310
|
item.style.overflow = 'visible';
|
|
313
311
|
dropdown.style.overflow = 'visible';
|
|
314
|
-
let portalWrapper = null;
|
|
315
|
-
|
|
316
|
-
function closePortal() {
|
|
317
|
-
if (portalWrapper && portalWrapper.parentNode) {
|
|
318
|
-
portalWrapper.parentNode.removeChild(portalWrapper);
|
|
319
|
-
}
|
|
320
|
-
portalWrapper = null;
|
|
321
|
-
dropdown.classList.remove('w--open');
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
function openPortal() {
|
|
325
|
-
if (portalWrapper && portalWrapper.parentNode) return;
|
|
326
|
-
const rect = toggle.getBoundingClientRect();
|
|
327
|
-
portalWrapper = document.createElement('div');
|
|
328
|
-
portalWrapper.setAttribute('data-bb-marquee-dropdown-portal', 'true');
|
|
329
|
-
portalWrapper.style.cssText = 'position:fixed;left:' + rect.left + 'px;top:' + rect.top + 'px;transform:translateY(-100%);margin-top:-4px;z-index:9999;';
|
|
330
|
-
const clone = list.cloneNode(true);
|
|
331
|
-
clone.style.display = 'block';
|
|
332
|
-
portalWrapper.appendChild(clone);
|
|
333
|
-
portalWrapper.addEventListener('mouseenter', function() {});
|
|
334
|
-
portalWrapper.addEventListener('mouseleave', function() { closePortal(); });
|
|
335
|
-
document.body.appendChild(portalWrapper);
|
|
336
|
-
dropdown.classList.add('w--open');
|
|
337
|
-
}
|
|
338
|
-
|
|
339
312
|
dropdown.addEventListener('mouseenter', function() {
|
|
340
|
-
|
|
313
|
+
dropdown.classList.add('w--open');
|
|
341
314
|
});
|
|
342
|
-
dropdown.addEventListener('mouseleave', function(
|
|
343
|
-
|
|
344
|
-
closePortal();
|
|
315
|
+
dropdown.addEventListener('mouseleave', function() {
|
|
316
|
+
dropdown.classList.remove('w--open');
|
|
345
317
|
});
|
|
346
318
|
});
|
|
347
319
|
});
|
|
@@ -419,7 +391,10 @@
|
|
|
419
391
|
const mainBlock = document.createElement('div');
|
|
420
392
|
mainBlock.innerHTML = originalHTML;
|
|
421
393
|
const hasDropdowns = this._hasDropdownInBlock(mainBlock);
|
|
422
|
-
if (hasDropdowns)
|
|
394
|
+
if (hasDropdowns) {
|
|
395
|
+
mainContainer.style.overflow = 'visible';
|
|
396
|
+
scrollContainer.style.overflow = 'visible';
|
|
397
|
+
}
|
|
423
398
|
|
|
424
399
|
// Précharger toutes les images avant clonage
|
|
425
400
|
const preloadAllImagesFirst = function(block) {
|