You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
cosmopet-architecture/wp-content/themes/cosmopet/static/production/js/script.js

52 lines
1.0 KiB

// Header menu
document.addEventListener('DOMContentLoaded', function () {
var swiper1 = document.querySelector('.productions_swiper')
if (swiper1.length !==0 && screen.width < 768) {
const breakpoint = screen.width;
const breakpoinChekker = function() {
if (breakpoint >= 768) {
if (swiper1 !== undefined) {
swiper1.destroy(true, true);
return;
}
} else if (breakpoint < 768) {
return enableSwiper();
}
};
window.addEventListener('resize', function() {
const breakpoint = screen.width;
if (breakpoint >= 768) {
if (swiper1 !== undefined) swiper1.destroy(true, true);
return;
} else if (breakpoint < 768) {
return enableSwiper();
}
})
const enableSwiper = function() {
const swiper = new Swiper('.productions_swiper', {
breakpoints: {
0: {
slidesPerView: 'auto',
spaceBetween: 16,
},
576: {
slidesPerView: 'auto',
spaceBetween: 32,
},
},
})
}
breakpoinChekker()
}
})