@widelab-nc/widelab 1.1.41 → 1.1.43
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 +3 -3
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/src/index.js +146 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -448,7 +448,42 @@ if (infoBar) {
|
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
+
let articleModalOpen;
|
|
452
|
+
function articleModalOpenAnimation() {
|
|
453
|
+
const articleModalWrapper = document.querySelector('.article-modal_main-wrapper');
|
|
454
|
+
const articleModalContent = document.querySelector('.article-modal_content-wrapper');
|
|
455
|
+
articleModalOpen = gsap.timeline({paused: true});
|
|
456
|
+
articleModalOpen.to(articleModalWrapper, {
|
|
457
|
+
autoAlpha: 1,
|
|
458
|
+
duration: 0.3,
|
|
459
|
+
ease: 'loader2',
|
|
460
|
+
})
|
|
461
|
+
articleModalOpen.from(articleModalContent, {
|
|
462
|
+
x: '100%',
|
|
463
|
+
duration: 0.4,
|
|
464
|
+
ease: 'loader2',
|
|
465
|
+
}, '-=0.2')
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
window.openArticleModal = function() {
|
|
469
|
+
articleModalOpen.play();
|
|
470
|
+
document.body.classList.add('is-scroll-off');
|
|
471
|
+
lenis.stop();
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
window.closeArticleModal = function() {
|
|
475
|
+
articleModalOpen.timeScale(1).reverse();
|
|
476
|
+
document.body.classList.remove('is-scroll-off');
|
|
477
|
+
lenis.start();
|
|
478
|
+
}
|
|
451
479
|
|
|
480
|
+
window.closeArticleModalOnEsc = function(e) {
|
|
481
|
+
document.addEventListener('keydown', function(event) {
|
|
482
|
+
if (event.key === "Escape") {
|
|
483
|
+
window.closeArticleModal();
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
}
|
|
452
487
|
|
|
453
488
|
// Safe new version that uses the same classes and structure
|
|
454
489
|
window.customCursorTextUpdate = function(el) {
|
|
@@ -478,7 +513,63 @@ window.customCursorTextUpdate = function(el) {
|
|
|
478
513
|
el.addEventListener('pointerleave', maybeDeactivate);
|
|
479
514
|
};
|
|
480
515
|
|
|
516
|
+
window.stickyServices = function (e) {
|
|
517
|
+
var wrapper = e;
|
|
518
|
+
if (!wrapper || wrapper.dataset.stickyServicesInit === 'true') return;
|
|
519
|
+
wrapper.dataset.stickyServicesInit = 'true';
|
|
520
|
+
|
|
521
|
+
var navItems = wrapper.querySelectorAll('.services_item-wrapper.is-animated');
|
|
522
|
+
var stackItems = wrapper.querySelectorAll('.services-stack-img');
|
|
523
|
+
|
|
524
|
+
var count = Math.min(navItems.length, stackItems.length);
|
|
525
|
+
if (count === 0) return;
|
|
481
526
|
|
|
527
|
+
var currentActive = -1;
|
|
528
|
+
var ticking = false;
|
|
529
|
+
|
|
530
|
+
function setActive(index) {
|
|
531
|
+
if (index === currentActive) return;
|
|
532
|
+
currentActive = index;
|
|
533
|
+
|
|
534
|
+
for (var i = 0; i < navItems.length; i++) {
|
|
535
|
+
navItems[i].classList.toggle('is-active', i === index);
|
|
536
|
+
}
|
|
537
|
+
for (var j = 0; j < stackItems.length; j++) {
|
|
538
|
+
stackItems[j].classList.toggle('is-active', j === index);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
function update() {
|
|
543
|
+
ticking = false;
|
|
544
|
+
|
|
545
|
+
var rect = wrapper.getBoundingClientRect();
|
|
546
|
+
var total = wrapper.offsetHeight - window.innerHeight;
|
|
547
|
+
|
|
548
|
+
// Wrapper not tall enough to scroll through (e.g. very tall viewport) — keep first item active.
|
|
549
|
+
if (total <= 0) {
|
|
550
|
+
setActive(0);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
var scrolled = -rect.top;
|
|
555
|
+
var progress = Math.min(1, Math.max(0, scrolled / total));
|
|
556
|
+
var activeIndex = Math.min(count - 1, Math.floor(progress * count));
|
|
557
|
+
|
|
558
|
+
setActive(activeIndex);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
function onScrollOrResize() {
|
|
562
|
+
if (!ticking) {
|
|
563
|
+
requestAnimationFrame(update);
|
|
564
|
+
ticking = true;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
window.addEventListener('scroll', onScrollOrResize, { passive: true });
|
|
569
|
+
window.addEventListener('resize', onScrollOrResize);
|
|
570
|
+
|
|
571
|
+
update(); // set correct state immediately on load (handles page-load mid-scroll / refresh position)
|
|
572
|
+
};
|
|
482
573
|
|
|
483
574
|
|
|
484
575
|
window.heroAnimationOnLoad = function(e) {
|
|
@@ -2216,6 +2307,59 @@ window.contactUsHide = function(e) {
|
|
|
2216
2307
|
}));
|
|
2217
2308
|
}
|
|
2218
2309
|
|
|
2310
|
+
|
|
2311
|
+
|
|
2312
|
+
window.expandablePadSticky = function (e) {
|
|
2313
|
+
var wrapper = e;
|
|
2314
|
+
if (!wrapper || wrapper.dataset.expandablePadStickyInit === 'true') return;
|
|
2315
|
+
wrapper.dataset.expandablePadStickyInit = 'true';
|
|
2316
|
+
|
|
2317
|
+
var items = wrapper.querySelectorAll('.service_expanded');
|
|
2318
|
+
var count = items.length;
|
|
2319
|
+
if (count === 0) return;
|
|
2320
|
+
|
|
2321
|
+
var currentActive = -1;
|
|
2322
|
+
var ticking = false;
|
|
2323
|
+
|
|
2324
|
+
function setActive(index) {
|
|
2325
|
+
if (index === currentActive) return;
|
|
2326
|
+
currentActive = index;
|
|
2327
|
+
for (var i = 0; i < items.length; i++) {
|
|
2328
|
+
var isTarget = i === index;
|
|
2329
|
+
items[i].classList.toggle('is-active', isTarget);
|
|
2330
|
+
items[i].style.height = isTarget ? items[i].scrollHeight + 'px' : '0px';
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
function update() {
|
|
2335
|
+
ticking = false;
|
|
2336
|
+
var rect = wrapper.getBoundingClientRect();
|
|
2337
|
+
var total = wrapper.offsetHeight - window.innerHeight;
|
|
2338
|
+
if (total <= 0) { setActive(0); return; }
|
|
2339
|
+
var scrolled = -rect.top;
|
|
2340
|
+
var progress = Math.min(1, Math.max(0, scrolled / total));
|
|
2341
|
+
var activeIndex = Math.min(count - 1, Math.floor(progress * (count + 1)));
|
|
2342
|
+
setActive(activeIndex);
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
function onScrollOrResize() {
|
|
2346
|
+
if (!ticking) { requestAnimationFrame(update); ticking = true; }
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
function onResize() {
|
|
2350
|
+
onScrollOrResize();
|
|
2351
|
+
if (currentActive !== -1) {
|
|
2352
|
+
items[currentActive].style.height = items[currentActive].scrollHeight + 'px';
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
window.addEventListener('scroll', onScrollOrResize, { passive: true });
|
|
2357
|
+
window.addEventListener('resize', onResize);
|
|
2358
|
+
update();
|
|
2359
|
+
};
|
|
2360
|
+
|
|
2361
|
+
|
|
2362
|
+
|
|
2219
2363
|
// Refresh Gsap scrollTriggers
|
|
2220
2364
|
window.scrollTriggerRefresh = function() {
|
|
2221
2365
|
function refreshScrollTrigger() {
|
|
@@ -2267,7 +2411,6 @@ window.closeInfoBar = function() {
|
|
|
2267
2411
|
lenis.destroy();
|
|
2268
2412
|
}
|
|
2269
2413
|
customGsapEasing();
|
|
2270
|
-
|
|
2271
2414
|
reloadOnBack();
|
|
2272
2415
|
revealFooter();
|
|
2273
2416
|
pageLoadAnimation();
|
|
@@ -2277,4 +2420,5 @@ window.closeInfoBar = function() {
|
|
|
2277
2420
|
disableScrollMenu();
|
|
2278
2421
|
scrollToHashOnLoad();
|
|
2279
2422
|
initClientLogosAnimation();
|
|
2280
|
-
|
|
2423
|
+
articleModalOpenAnimation();
|
|
2424
|
+
});
|