gcg-website/assets/js/script.js

112 lines
3.3 KiB
JavaScript
Raw Normal View History

2022-03-18 13:35:57 +01:00
(function ($) {
'use strict';
2023-04-23 14:14:40 +02:00
// adapt header to height
2023-02-09 12:29:38 +01:00
function adaptHeight () {
var height = $('.top-header').innerHeight();
2023-02-01 20:24:20 +01:00
if ($('header').offset().top > 10) {
$('.top-header').addClass('hide');
$('.navigation').addClass('nav-bg');
$('.navigation').css('margin-top','-'+height+'px');
} else {
$('.top-header').removeClass('hide');
2023-02-09 12:29:38 +01:00
if ( !$('#top-banner').length) {
2023-02-01 20:24:20 +01:00
$('.navigation').removeClass('nav-bg');
}
$('.navigation').css('margin-top','-'+0+'px');
}
2023-02-09 12:29:38 +01:00
}
2023-04-23 14:14:40 +02:00
// load scripts
2023-02-09 12:29:38 +01:00
$(window).on('load', function () {
$('.preloader').fadeOut(100);
adaptHeight();
2023-02-01 20:24:20 +01:00
if ($('#top-banner').length) {
$('.navigation').addClass('nav-bg');
$('.hero-section').addClass('hs-banner');
$('.page-title-section').addClass('pts-banner');
} else {
$('.hero-section').removeClass('hs-banner');
$('.page-title-section').removeClass('pts-banner');
}
2022-03-18 13:35:57 +01:00
});
2023-04-23 14:14:40 +02:00
// sticky menu
2023-02-09 12:29:38 +01:00
$(window).scroll(adaptHeight);
2022-03-18 13:35:57 +01:00
2023-04-23 14:14:40 +02:00
// hero slider
$('.hero-slider').slick({
2022-03-18 13:35:57 +01:00
autoplay: true,
2023-02-01 20:24:20 +01:00
autoplaySpeed: 5000,
2022-03-18 13:35:57 +01:00
pauseOnFocus: false,
2023-04-04 15:28:15 +02:00
pauseOnHover: true,
2022-03-18 13:35:57 +01:00
infinite: true,
arrows: true,
2024-01-20 20:09:43 +01:00
prevArrow: '<button type=\'button\' class=\'prevArrow\'><svg xmlns="http://www.w3.org/2000/svg" id="mdi-chevron-left" class="arrowIcon" viewBox="0 0 24 24" height="1em" width="1em" fill="currentColor"><path d="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z" /></svg></button>',
nextArrow: '<button type=\'button\' class=\'nextArrow\'><svg xmlns="http://www.w3.org/2000/svg" id="mdi-chevron-left" class="arrowIcon" viewBox="0 0 24 24" height="1em" width="1em" fill="currentColor"><path xmlns="http://www.w3.org/2000/svg" d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"/></svg></button>',
2022-03-18 13:35:57 +01:00
dots: true
});
// venobox popup
$(document).ready(function () {
new VenoBox({
selector: '.vb-video',
spinner: 'grid'
});
new VenoBox({
selector: '.vb-gallery',
numeration: true,
infinigall: true,
share: true,
shareStyle: 'block',
spinner: 'grid'
});
2022-03-18 13:35:57 +01:00
});
// filter
$(document).ready(function () {
const shuffleInstance = new Shuffle($('.filter-container'), {
itemSelector: '.filter-item',
sizer: '.filter-sizer', // could also be a selector: '.js-shuffle-sizer'
delimiter: ','
});
2022-03-18 13:35:57 +01:00
$('.filter-controls li').on('click', function () {
$('.filter-controls li').removeClass('active');
$(this).addClass('active');
shuffleInstance.filter($(this).data('filter'))
2022-03-18 13:35:57 +01:00
});
});
2023-04-23 14:14:40 +02:00
// count up
2022-03-18 13:35:57 +01:00
function counter() {
var oTop;
if ($('.count').length !== 0) {
oTop = $('.count').offset().top - window.innerHeight;
}
if ($(window).scrollTop() > oTop) {
$('.count').each(function () {
var $this = $(this),
countTo = $this.attr('data-count');
$({
countNum: $this.text()
}).animate({
countNum: countTo
}, {
duration: 1000,
easing: 'swing',
step: function () {
$this.text(Math.floor(this.countNum));
},
complete: function () {
$this.text(this.countNum);
}
});
});
}
}
$(window).on('scroll', function () {
counter();
});
2023-04-04 15:28:15 +02:00
2022-03-18 13:35:57 +01:00
})(jQuery);