@import "../../resources/scss/util/variables";
@import "../../resources/scss/util/mixins";
.block-tech-partners{
padding: 3em 0;
@include bp($lg){
padding: 6em 0;
}
&__tabs{
flex-wrap: nowrap;
margin: rem-calc(0 0 72 0);
.bt-tabs{
display: flex;
width: 100%;
margin-bottom: rem-calc(40);
overflow-y: hidden;
overflow-x: hidden;
transition: 0.3s ease padding;
&:hover{
padding-bottom: rem-calc(4);
overflow-x: auto;
}
@media (hover: none) and (pointer: coarse) {
overflow-x: auto;
padding-bottom: 0;
}
@include bp($lg){
margin-bottom: rem-calc(66);
}
@include bp($xl){
margin-left: calc( calc( 100vw - 1220px ) / 2 );
}
@include bp($xxl){
margin-left: calc( calc( 100vw - 1340px ) / 2 );
}
&::-webkit-scrollbar {
height: 4px;
@media (hover: none) and (pointer: coarse) {
height: 0;
}
}
/* Track */
&::-webkit-scrollbar-track {
background: #f1f1f1;
}
/* Handle */
&::-webkit-scrollbar-thumb {
background: #888;
}
/* Handle on hover */
&::-webkit-scrollbar-thumb:hover {
background: #555;
}
}
&_nav{
display: block;
font-weight: 300;
font-size: rem-calc(18);
line-height: rem-calc(18);
letter-spacing: 0.05em;
text-decoration: none;
color: $black;
text-align: center;
border-bottom: 1px solid $grey-secondary;
width: rem-calc(220);
margin-right: rem-calc(24);
flex-shrink: 0;
padding-bottom: rem-calc(16);
@include bp($lg){
width: rem-calc(416);
font-size: rem-calc(24);
line-height: rem-calc(24);
padding-bottom: rem-calc(32);
}
&.active{
font-weight: 600;
border-bottom: 1px solid $secondary;
}
}
}
&__col{
display: none;
margin-bottom: rem-calc(24);
&.show{
display: block;
}
}
&__item{
border: 1px solid $grey-secondary;
position: relative;
border-radius: rem-calc(16);
overflow: hidden;
height: 100%;
@include bp($lg){
border-radius: rem-calc(32);
}
&:hover{
.block-tech-partners__wrap{
opacity: 0;
}
.block-tech-partners__overlay{
opacity: 1;
}
}
}
&__wrap{
color: $black;
padding: rem-calc(16);
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
justify-content: center;
transition: 0.25s ease opacity;
position: absolute;
top: 0;
left: 0;
@include bp($md){
justify-content: inherit;
flex-direction: row-reverse;
align-items: center;
}
@include bp($lg){
border-radius: rem-calc(32);
padding: rem-calc(48);
background-color: $white;
}
}
&__img-wrapper{
width: 100%;
text-align: center;
margin-bottom: rem-calc(16);
@include bp($md){
width: 50%;
margin-bottom: 0;
}
img{
max-width: rem-calc(230);
}
}
&__content{
width: 100%;
text-align: center;
@include bp($md){
width: 50%;
text-align: left;
}
}
&__heading{
font-size: rem-calc(20);
line-height: rem-calc(24);
font-weight: 400;
letter-spacing: 0.05em;
@include bp($lg){
font-size: rem-calc(24);
line-height: rem-calc(32);
}
}
&__overlay{
color: $white;
opacity: 0;
padding: rem-calc(16);
background-color: $secondary;
width: 100%;
height: 100%;
transition: 0.25s ease opacity;
position: relative;
min-height: rem-calc(240);
@include bp($lg){
padding: rem-calc(48);
min-height: inherit;
}
&_heading{
font-size: rem-calc(20);
line-height: rem-calc(24);
font-weight: 600;
letter-spacing: 0.05em;
margin-bottom: rem-calc(12);
@include bp($lg){
font-size: rem-calc(24);
line-height: rem-calc(32);
}
}
&_content{
font-weight: 400;
font-size: rem-calc(16);
line-height: rem-calc(24);
letter-spacing: 0.05em;
margin-bottom: rem-calc(24);
}
}
}
function filterPartners(c) {
var x, i;
x = document.querySelectorAll(".block-tech-partners__col");
if (c == "all") c = "";
Array.from(x).forEach(item => {
removeActiveClass(item, "show");
if (item.className.indexOf(c) > -1) addActiveClass(item, "show");
});
}
function addActiveClass(ele, name) {
var i, arr1, arr2;
arr1 = ele.className.split(" ");
arr2 = name.split(" ");
for (i = 0; i < arr2.length; i++) {
if (arr1.indexOf(arr2[i]) == -1) {
ele.className += " " + arr2[i];
}
}
}
function removeActiveClass(ele, name) {
var i, arr1, arr2;
arr1 = ele.className.split(" ");
arr2 = name.split(" ");
for (i = 0; i < arr2.length; i++) {
while (arr1.indexOf(arr2[i]) > -1) {
arr1.splice(arr1.indexOf(arr2[i]), 1);
}
}
ele.className = arr1.join(" ");
}
class TechPartners {
/**
* Create and initialise objects of this class
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor
* @param {object} block
*/
constructor() {
this.blocks = document.querySelectorAll('.block-tech-partners');
this.init();
}
/**
* Example function to run class logic
* Can access `this.block`
*/
init() {
filterPartners("all");
this.blocks.forEach((block) => {
var btabsContainer = block.querySelectorAll('.bt-tabs');
btabsContainer.forEach(function(element){
element.addEventListener("wheel", function (e) {
e.preventDefault();
element.scrollLeft += e.deltaY;
});
});
var filterBtns = block.querySelectorAll(".block-tech-partners__tabs_nav");
for (var i = 0; i < filterBtns.length; i++) {
filterBtns[i].addEventListener("click", function() {
this.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
var current = block.getElementsByClassName("active");
current[0].className = current[0].className.replace(" active", "");
this.className += " active";
filterPartners(this.dataset.filterby);
});
}
});
}
}
new TechPartners();