91 lines
2.7 KiB
JavaScript
91 lines
2.7 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
|
|
});
|
|
}
|
|
|
|
$(window).on('load', initSticky);
|
|
|
|
$(window).on('resize orientationchange', () => ScrollTrigger.refresh());
|
|
}
|
|
});
|
|
|
|
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);
|
|
});
|
|
}); |