File: /var/www/html/wp-content/themes/polygant_2023/inc/js/home.js
(function ($) {
var mqXS, mqHS, //media query vars
carouselWrap, //section 3, or carousel-recomended
itemsWrap, //section4, or grid-team section
itemsWrapId; //interval id
mqXS = window.matchMedia("(max-width: 479px)");
mqHS = window.matchMedia("(min-width: 480px) and (max-width: 767px)");
carouselWrap = $("#carouselWrap");
itemsWrap = $("#itemsWrap");
/**
* Init particles plugin
* Header background image
*/
particlesJS.load('particles-js', metaVars.getBaseUrl + '/wp-content/themes/polygant/inc/js/other/particles.json', function () {
console.log('callback - particles.js config loaded');
});
/**
* Init owlcarousel.
* Slider section.
*/
$('.sliderWrap').owlCarousel({
items: 1,
loop: true,
dots: false,
nav: true,
navText: ["‹", "›"],
navSpeed: 1000
});
/**
* Init owlcarousel.
* Recommended section.
*/
carouselWrap.owlCarousel({
items: 3,
loop: true,
dots: true,
nav: false,
margin: 40,
responsive: {
0: {
items: 1,
},
768: {
items: 3,
},
}
});
/**
* Init owlcarousel.
* Team section.
*/
function initialize() {
if (mqHS.matches || mqXS.matches) {
itemsWrap.addClass('owl-carousel owl-theme');
itemsWrap.owlCarousel({
items: 1,
loop: true,
dots: false,
nav: true,
navText: ["‹", "›"],
navSpeed: 1000
});
} else {
itemsWrap.trigger('destroy.owl.carousel').removeClass('owl-carousel owl-theme owl-loaded');
itemsWrap.find('.owl-stage-outer').children().unwrap();
}
}
/**
* Resize
*/
$(window).resize(function () {
//team section carousel
clearTimeout(itemsWrapId);
itemsWrapId = setTimeout(initialize, 500);
});
//team section carousel
initialize();
$('#blockChain .imgWrap img').css('max-height', $('#blockChain .sliderWrap .owl-stage').innerHeight())
})(jQuery);