205 lines
4.3 KiB
JavaScript
205 lines
4.3 KiB
JavaScript
jQuery(function ($) {
|
|
if ($('body.page-id-25').length) {
|
|
gsap.registerPlugin(ScrollTrigger)
|
|
|
|
function initSticky() {
|
|
ScrollTrigger.getById('heroImagePin')?.kill()
|
|
|
|
const $pin = $('.box-1 .col-2')
|
|
const $end = $('.box-2 .row')
|
|
if (!$pin.length || !$end.length) return
|
|
|
|
const $row = $pin.closest('.row')
|
|
$row.css('min-height', $('img', $pin).outerHeight())
|
|
|
|
ScrollTrigger.create({
|
|
id: 'heroImagePin',
|
|
trigger: $pin[0],
|
|
pin: true,
|
|
start: 'top top',
|
|
end: () => {
|
|
const pinTop = $pin.offset().top
|
|
const pinH = $pin.outerHeight()
|
|
const endBottom = $end.offset().top + $end.outerHeight()
|
|
return '+=' + Math.max(0, endBottom - pinTop - pinH)
|
|
},
|
|
scrub: 0.5,
|
|
anticipatePin: 1,
|
|
invalidateOnRefresh: true,
|
|
pinSpacing: true,
|
|
pinReparent: true,
|
|
})
|
|
}
|
|
|
|
if ($(window).width() > 992) {
|
|
$(window).on('load', initSticky)
|
|
|
|
$(window).on('resize orientationchange', () => ScrollTrigger.refresh())
|
|
}
|
|
|
|
if ($(window).width() <= 576) {
|
|
const box = document.querySelector('.box-1')
|
|
const col2 = box.querySelector('.col-2')
|
|
const row = box.querySelector('.row')
|
|
|
|
const moveX = row.offsetLeft - col2.offsetLeft - 30
|
|
gsap.to(col2, {
|
|
x: moveX,
|
|
ease: 'none',
|
|
scrollTrigger: {
|
|
trigger: box,
|
|
start: 'top-=15px top',
|
|
end: () => `+=${box.offsetHeight}`,
|
|
scrub: true,
|
|
pin: true,
|
|
markers: false,
|
|
},
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
jQuery(function ($) {
|
|
if (!$('body').hasClass('page-id-47')) return
|
|
|
|
const $body = $('body')
|
|
|
|
$body.on('click', '.tile .tile--wrapper .tile--btn', function (e) {
|
|
e.preventDefault()
|
|
$body.addClass('no-scroll')
|
|
|
|
const $tile = $(this).closest('.tile')
|
|
const $sidebar = $tile.find('.tile-sidebar')
|
|
|
|
$('.tile')
|
|
.not($tile)
|
|
.removeClass('active')
|
|
.find('.tile-sidebar')
|
|
.fadeOut(200)
|
|
|
|
$sidebar.fadeToggle(200)
|
|
$tile.toggleClass('active')
|
|
})
|
|
|
|
$body.on(
|
|
'click',
|
|
'.tile .tile-sidebar .tile--btn, .tile .tile-sidebar-bg',
|
|
function (e) {
|
|
e.preventDefault()
|
|
$body.removeClass('no-scroll')
|
|
$(this)
|
|
.closest('.tile-sidebar')
|
|
.fadeOut(200)
|
|
.closest('.tile')
|
|
.removeClass('active')
|
|
}
|
|
)
|
|
})
|
|
|
|
jQuery(function ($) {
|
|
$('body').on('click', '.c-tabs .c-tabs--nav li', function (e) {
|
|
e.preventDefault()
|
|
|
|
let tabId = $(this).attr('tab_id')
|
|
|
|
$(this)
|
|
.closest('.c-tabs')
|
|
.find('.c-tabs--nav li')
|
|
.not(this)
|
|
.removeClass('active')
|
|
$(this).addClass('active')
|
|
|
|
$(this)
|
|
.closest('.c-tabs')
|
|
.find('.c-tabs--content [tab_id]')
|
|
.not('[tab_id=' + tabId + ']')
|
|
.hide()
|
|
$(this)
|
|
.closest('.c-tabs')
|
|
.find('.c-tabs--content [tab_id=' + $(this).attr('tab_id') + ']')
|
|
.show()
|
|
})
|
|
$('.c-tabs .c-tabs--nav li:first-child').trigger('click')
|
|
|
|
$('body').on('click', '.c-acc .c-acc--item .c-acc--head', function (e) {
|
|
e.preventDefault()
|
|
|
|
$(this)
|
|
.closest('.c-acc')
|
|
.find('.c-acc--item')
|
|
.not($(this).closest('.c-acc--item'))
|
|
.removeClass('active')
|
|
$(this).closest('.c-acc--item').toggleClass('active')
|
|
|
|
$(this)
|
|
.closest('.c-acc')
|
|
.find('.c-acc--item .c-acc--body')
|
|
.not($(this).next('.c-acc--body'))
|
|
.slideUp(200)
|
|
$(this).next('.c-acc--body').slideToggle(200)
|
|
})
|
|
})
|
|
|
|
jQuery(function ($) {
|
|
$('body').on('click', '#nav-menu-toggle', function (e) {
|
|
e.preventDefault()
|
|
|
|
$(this).toggleClass('active')
|
|
$('#masthead').toggleClass('active')
|
|
$('#masthead .site-branding').toggleClass('active')
|
|
|
|
$('#site-navigation').stop().delay(250).slideToggle()
|
|
$('#site-navigation').toggleClass('active')
|
|
|
|
$('body').toggleClass('no-scroll')
|
|
})
|
|
})
|
|
|
|
jQuery(function ($) {
|
|
document.querySelectorAll('.animate-text').forEach((block) => {
|
|
gsap.fromTo(
|
|
block.querySelectorAll('.word .char'),
|
|
{
|
|
opacity: 0.2,
|
|
},
|
|
{
|
|
scrollTrigger: {
|
|
trigger: block,
|
|
start: 'top 80%',
|
|
toggleActions: 'play none none none',
|
|
},
|
|
opacity: 1,
|
|
duration: 0.3,
|
|
stagger: {
|
|
each: 0.02,
|
|
from: 'start',
|
|
},
|
|
ease: 'power2.out',
|
|
}
|
|
)
|
|
})
|
|
})
|
|
|
|
jQuery(function ($) {
|
|
gsap.fromTo(
|
|
document.querySelectorAll('.animate-text-linear .word .char'),
|
|
{
|
|
opacity: 0.2,
|
|
},
|
|
{
|
|
scrollTrigger: {
|
|
trigger: '.animate-text-linear',
|
|
start: 'top 80%',
|
|
toggleActions: 'play none none none',
|
|
},
|
|
opacity: 1,
|
|
duration: 0.25,
|
|
stagger: {
|
|
each: 0.015,
|
|
from: 'start',
|
|
},
|
|
ease: 'power2.out',
|
|
}
|
|
)
|
|
})
|