@widelab-nc/widelab 1.1.34 → 1.1.35
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/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/src/index.js +78 -3
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -627,6 +627,52 @@ window.reviewsSlider = function(e) {
|
|
|
627
627
|
});
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
+
// Partner slider
|
|
631
|
+
window.partnerSlider = function (e) {
|
|
632
|
+
// Keep the same querySelector for consistency with teamSlider
|
|
633
|
+
const teamList = e.querySelector('.team_collection_list');
|
|
634
|
+
|
|
635
|
+
// Initialize Splide with drag restored
|
|
636
|
+
const splide = new Splide(e, {
|
|
637
|
+
type: 'slide',
|
|
638
|
+
fixedWidth: '20%',
|
|
639
|
+
padding: { left: '2.5rem', right: 0 },
|
|
640
|
+
focus: 0,
|
|
641
|
+
gap: 0,
|
|
642
|
+
pagination: true,
|
|
643
|
+
omitEnd: true,
|
|
644
|
+
arrows: false,
|
|
645
|
+
drag: true, // restored dragging
|
|
646
|
+
easing: 'cubic-bezier(0.83, 0, 0.17, 1)',
|
|
647
|
+
snap: true,
|
|
648
|
+
classes: {
|
|
649
|
+
pagination: 'splide__pagination facts-pagination partner-bullets',
|
|
650
|
+
page: 'splide__pagination__page facts-page',
|
|
651
|
+
},
|
|
652
|
+
breakpoints: {
|
|
653
|
+
992: { fixedWidth: '40%', padding: { left: '1.75rem' }, drag: 'free', snap: false },
|
|
654
|
+
560: { fixedWidth: '75%', padding: { left: '1.375rem' }, drag: 'free', snap: false },
|
|
655
|
+
},
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
splide.mount();
|
|
659
|
+
|
|
660
|
+
// Removed: click-to-next handler
|
|
661
|
+
|
|
662
|
+
// GSAP in-view animation
|
|
663
|
+
gsap.from(e, {
|
|
664
|
+
scrollTrigger: {
|
|
665
|
+
trigger: e,
|
|
666
|
+
start: 'top bottom',
|
|
667
|
+
end: 'bottom bottom',
|
|
668
|
+
scrub: 1,
|
|
669
|
+
once: true,
|
|
670
|
+
},
|
|
671
|
+
x: '10%',
|
|
672
|
+
opacity: 0,
|
|
673
|
+
ease: 'linear',
|
|
674
|
+
});
|
|
675
|
+
};
|
|
630
676
|
// Element padding change on scroll
|
|
631
677
|
window.elementPaddingChange = function(e) {
|
|
632
678
|
gsap.to(e, {
|
|
@@ -1503,20 +1549,35 @@ window.initBentoRevealScrub = function (container) {
|
|
|
1503
1549
|
}
|
|
1504
1550
|
);
|
|
1505
1551
|
};
|
|
1506
|
-
|
|
1507
1552
|
window.initPartnerVideos = function (container) {
|
|
1508
1553
|
const items = Array.from(container.querySelectorAll('.partner_item'));
|
|
1509
1554
|
const vids = items.map(i => i.querySelector('video')).filter(Boolean);
|
|
1510
1555
|
|
|
1556
|
+
// Helper: pause all other videos
|
|
1511
1557
|
const pauseAll = (except) => {
|
|
1512
1558
|
vids.forEach(v => {
|
|
1513
1559
|
if (v !== except) {
|
|
1514
1560
|
v.pause();
|
|
1515
1561
|
v.muted = true;
|
|
1562
|
+
const parent = v.closest('.partner_item');
|
|
1563
|
+
if (parent) toggleIcons(parent, false);
|
|
1516
1564
|
}
|
|
1517
1565
|
});
|
|
1518
1566
|
};
|
|
1519
1567
|
|
|
1568
|
+
// Helper: toggle play/pause icons
|
|
1569
|
+
function toggleIcons(item, isPlaying) {
|
|
1570
|
+
const playIcon = item.querySelector('.is-play');
|
|
1571
|
+
const pauseIcon = item.querySelector('.is-pause');
|
|
1572
|
+
if (isPlaying) {
|
|
1573
|
+
if (playIcon) playIcon.style.display = 'none';
|
|
1574
|
+
if (pauseIcon) pauseIcon.style.display = 'block';
|
|
1575
|
+
} else {
|
|
1576
|
+
if (playIcon) playIcon.style.display = 'block';
|
|
1577
|
+
if (pauseIcon) pauseIcon.style.display = 'none';
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1520
1581
|
items.forEach((item) => {
|
|
1521
1582
|
const v = item.querySelector('video');
|
|
1522
1583
|
if (!v) return;
|
|
@@ -1527,17 +1588,29 @@ window.initPartnerVideos = function (container) {
|
|
|
1527
1588
|
v.setAttribute('playsinline', '');
|
|
1528
1589
|
v.playsInline = true;
|
|
1529
1590
|
|
|
1591
|
+
// Default state on init (show play icon)
|
|
1592
|
+
toggleIcons(item, false);
|
|
1593
|
+
|
|
1594
|
+
// Handle click (play/pause toggle)
|
|
1530
1595
|
item.addEventListener('click', () => {
|
|
1531
1596
|
if (v.paused) {
|
|
1532
1597
|
pauseAll(v);
|
|
1533
1598
|
v.muted = false;
|
|
1534
1599
|
v.play();
|
|
1600
|
+
toggleIcons(item, true);
|
|
1535
1601
|
} else {
|
|
1536
1602
|
v.pause();
|
|
1603
|
+
toggleIcons(item, false);
|
|
1537
1604
|
}
|
|
1538
1605
|
});
|
|
1606
|
+
|
|
1607
|
+
// Handle pause and ended (ensure icons reset)
|
|
1608
|
+
v.addEventListener('pause', () => toggleIcons(item, false));
|
|
1609
|
+
v.addEventListener('ended', () => toggleIcons(item, false));
|
|
1610
|
+
v.addEventListener('play', () => toggleIcons(item, true));
|
|
1539
1611
|
});
|
|
1540
1612
|
|
|
1613
|
+
// Pause videos when out of viewport
|
|
1541
1614
|
const rootEl =
|
|
1542
1615
|
document.querySelector('[data-scroll-root]') ||
|
|
1543
1616
|
document.querySelector('[data-smooth-scroll-root]') ||
|
|
@@ -1548,7 +1621,10 @@ window.initPartnerVideos = function (container) {
|
|
|
1548
1621
|
entries.forEach(({ isIntersecting, target }) => {
|
|
1549
1622
|
const v = target.querySelector('video');
|
|
1550
1623
|
if (!v) return;
|
|
1551
|
-
if (!isIntersecting)
|
|
1624
|
+
if (!isIntersecting) {
|
|
1625
|
+
v.pause();
|
|
1626
|
+
toggleIcons(target, false);
|
|
1627
|
+
}
|
|
1552
1628
|
});
|
|
1553
1629
|
},
|
|
1554
1630
|
{ root: rootEl, threshold: 0.25 }
|
|
@@ -1558,7 +1634,6 @@ window.initPartnerVideos = function (container) {
|
|
|
1558
1634
|
};
|
|
1559
1635
|
|
|
1560
1636
|
|
|
1561
|
-
|
|
1562
1637
|
// Case study - What's next interaction
|
|
1563
1638
|
window.whatsNext = function() {
|
|
1564
1639
|
const caseItem = document.querySelectorAll('.whats-next_links_item.is-case');
|