@bebranded/bb-contents 1.1.15 → 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 +10 -42
- 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,7 +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 (
|
|
300
|
+
// Active le comportement hover pour les dropdowns dans un bloc du marquee (w--open uniquement, position et styles 100 % Webflow)
|
|
301
301
|
_enableMarqueeDropdowns: function(block) {
|
|
302
302
|
if (!block || !block.querySelectorAll) return;
|
|
303
303
|
const items = block.querySelectorAll('.bb-marquee_item, [role="listitem"]');
|
|
@@ -306,49 +306,14 @@
|
|
|
306
306
|
const dropdowns = item.querySelectorAll('.w-dropdown, [class*="dropdown"]');
|
|
307
307
|
dropdowns.forEach(function(dropdown) {
|
|
308
308
|
const list = dropdown.querySelector('.w-dropdown-list, [class*="dropdown-list"], [class*="dropdown_list"]');
|
|
309
|
-
|
|
310
|
-
if (!list || !toggle) return;
|
|
309
|
+
if (!list) return;
|
|
311
310
|
item.style.overflow = 'visible';
|
|
312
311
|
dropdown.style.overflow = 'visible';
|
|
313
|
-
let leaveTimer;
|
|
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
|
-
clearTimeout(leaveTimer);
|
|
326
|
-
if (portalWrapper && portalWrapper.parentNode) return;
|
|
327
|
-
const rect = toggle.getBoundingClientRect();
|
|
328
|
-
portalWrapper = document.createElement('div');
|
|
329
|
-
portalWrapper.setAttribute('data-bb-marquee-dropdown-portal', 'true');
|
|
330
|
-
portalWrapper.style.cssText = 'position:fixed;left:' + rect.left + 'px;top:' + (rect.bottom + 4) + 'px;z-index:9999;';
|
|
331
|
-
const clone = list.cloneNode(true);
|
|
332
|
-
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
|
-
portalWrapper.appendChild(clone);
|
|
339
|
-
portalWrapper.addEventListener('mouseenter', function() { clearTimeout(leaveTimer); });
|
|
340
|
-
portalWrapper.addEventListener('mouseleave', function() {
|
|
341
|
-
leaveTimer = setTimeout(closePortal, 150);
|
|
342
|
-
});
|
|
343
|
-
document.body.appendChild(portalWrapper);
|
|
344
|
-
dropdown.classList.add('w--open');
|
|
345
|
-
}
|
|
346
|
-
|
|
347
312
|
dropdown.addEventListener('mouseenter', function() {
|
|
348
|
-
|
|
313
|
+
dropdown.classList.add('w--open');
|
|
349
314
|
});
|
|
350
315
|
dropdown.addEventListener('mouseleave', function() {
|
|
351
|
-
|
|
316
|
+
dropdown.classList.remove('w--open');
|
|
352
317
|
});
|
|
353
318
|
});
|
|
354
319
|
});
|
|
@@ -426,7 +391,10 @@
|
|
|
426
391
|
const mainBlock = document.createElement('div');
|
|
427
392
|
mainBlock.innerHTML = originalHTML;
|
|
428
393
|
const hasDropdowns = this._hasDropdownInBlock(mainBlock);
|
|
429
|
-
if (hasDropdowns)
|
|
394
|
+
if (hasDropdowns) {
|
|
395
|
+
mainContainer.style.overflow = 'visible';
|
|
396
|
+
scrollContainer.style.overflow = 'visible';
|
|
397
|
+
}
|
|
430
398
|
|
|
431
399
|
// Précharger toutes les images avant clonage
|
|
432
400
|
const preloadAllImagesFirst = function(block) {
|