Skip to content

Commit 4fb8beb

Browse files
committed
Rebuild - Init
1 parent fcc5d33 commit 4fb8beb

41 files changed

Lines changed: 2429 additions & 3317 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/about.js

Lines changed: 34 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,39 @@
1-
const swiper = new Swiper('.about-team_slider', {
2-
// Optional parameters
3-
slidesPerView: 'auto',
4-
spaceBetween: 20,
5-
// Navigation arrows
6-
navigation: {
7-
nextEl: '.swiper-arrow.next',
8-
prevEl: '.swiper-arrow.prev',
9-
},
10-
});
11-
12-
const swiperModal = new Swiper('.about-team_modal-slider .max-width-full', {
13-
// Optional parameters
14-
slidesPerView: 1,
15-
noSwiping: false,
16-
navigation: {
17-
prevEl: '.about-team-modal-arrow.prev',
18-
nextEl: '.about-team-modal-arrow.next',
19-
},
20-
breakpoints: {
21-
0: {
22-
direction: 'horizontal',
23-
spaceBetween: 8,
24-
autoHeight: true,
25-
},
26-
992: {
27-
direction: 'vertical',
28-
spaceBetween: 20,
29-
autoHeight: false,
30-
},
31-
},
32-
});
1+
gsap.registerPlugin(ScrollTrigger, SplitText);
332

34-
$('.about-team_card').on('click', function () {
35-
revealModal($(this).closest('.w-dyn-item').index());
36-
});
3+
function initHighlightText() {
4+
let splitHeadingTargets = document.querySelectorAll('[data-highlight-text]');
5+
splitHeadingTargets.forEach((heading) => {
6+
const scrollStart = heading.getAttribute('data-highlight-scroll-start') || 'top 70%';
7+
const scrollEnd = heading.getAttribute('data-highlight-scroll-end') || 'center 40%';
8+
const fadedValue = heading.getAttribute('data-highlight-fade') || 0.2; // Opacity of letter
9+
const staggerValue = heading.getAttribute('data-highlight-stagger') || 0.1; // Smoother reveal
3710

38-
$('.blog-detail_hero-list-item')
39-
.not('[fs-cmsstatic-element]')
40-
.on('click', function () {
41-
revealModal($(this).closest('.w-dyn-item').index());
11+
new SplitText(heading, {
12+
type: 'words, chars',
13+
autoSplit: true,
14+
onSplit(self) {
15+
let ctx = gsap.context(() => {
16+
let tl = gsap.timeline({
17+
scrollTrigger: {
18+
scrub: true,
19+
trigger: heading,
20+
start: scrollStart,
21+
end: scrollEnd,
22+
},
23+
});
24+
tl.from(self.chars, {
25+
autoAlpha: fadedValue,
26+
stagger: staggerValue,
27+
ease: 'linear',
28+
});
29+
});
30+
return ctx; // return our animations so GSAP can clean them up when onSplit fires
31+
},
32+
});
4233
});
43-
44-
$('[data-modal="hide"]').on('click', hideModal);
45-
46-
function revealModal(index) {
47-
swiperModal.slideTo(index);
48-
$('.about-team_modal').fadeIn();
49-
$('html, body').addClass('overflow-hidden');
5034
}
5135

52-
function hideModal() {
53-
$('.about-team_modal').fadeOut();
54-
$('html, body').removeClass('overflow-hidden');
55-
}
36+
// Initialize Highlight Text on Scroll
37+
document.addEventListener('DOMContentLoaded', () => {
38+
initHighlightText();
39+
});

src/anchor-tags.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
export function installAndScrollAnchorTags() {
2+
// Automatically adds IDs to every heading so we can anchor link automatically.
3+
document.querySelectorAll('h1,h2,h3').forEach((el) => {
4+
const id = el.innerText
5+
.toLowerCase()
6+
.split(' ')
7+
.map((a) => a.replace(/\W/g, ''))
8+
.join('-');
9+
el.style.position = 'relative';
10+
const anchorEl = document.createElement('div');
11+
12+
anchorEl.style.position = 'absolute';
13+
anchorEl.style.top = '-90px';
14+
anchorEl.style.left = '0';
15+
16+
anchorEl.id = id;
17+
el.appendChild(anchorEl);
18+
19+
// If the hash is set, make sure to scroll to it.
20+
requestAnimationFrame(() => {
21+
if (window.location.hash) {
22+
const hashEl = document.getElementById(window.location.hash.replace('#', ''));
23+
window.scrollTo({
24+
top: hashEl.getBoundingClientRect().top + window.scrollY,
25+
});
26+
}
27+
}, 1);
28+
});
29+
}

src/animations.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
function animateLines() {
2+
$('[data-line-dividers]').each(function () {
3+
let wrap = $(this);
4+
let lines = wrap.find('.line-divider');
5+
6+
lines.each(function (index) {
7+
let scaleStart = $(this).attr('data-start-scale') || 0;
8+
let scaleEnd = $(this).attr('data-end-scale') || 0.2;
9+
10+
gsap.set($(this), {
11+
scaleY: scaleStart,
12+
transformOrigin: 'bottom',
13+
});
14+
15+
gsap.to($(this), {
16+
scaleY: scaleEnd,
17+
ease: 'power2.out',
18+
scrollTrigger: {
19+
trigger: wrap,
20+
start: 'top bottom',
21+
end: 'bottom top',
22+
scrub: 1,
23+
},
24+
});
25+
});
26+
});
27+
}
28+
29+
animateLines();
30+
31+
export function initAnims() {
32+
animateLines();
33+
}

src/blog.css

Lines changed: 0 additions & 228 deletions
This file was deleted.

0 commit comments

Comments
 (0)