function _(el) { if (!(this instanceof _)) { return new _(el); } this.el = document.getElementById(el); } _.prototype.fade = function fade(type, ms) { var isIn = type === 'in', opacity = isIn ? 0 : 1, interval = 50, duration = ms, gap = interval / duration, self = this; if (isIn) { self.el.style.display = 'inline'; self.el.style.opacity = opacity; } function func() { opacity = isIn ? opacity + gap : opacity - gap; self.el.style.opacity = opacity; if (opacity <= 0) self.el.style.display = 'none'; if (opacity <= 0 || opacity >= 1) window.clearInterval(fading); } var fading = window.setInterval(func, interval); } function getUrlVars() { var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) { vars[key] = value; }); return vars; } document.addEventListener('DOMContentLoaded', function() { var body = document.getElementsByTagName('body')[0]; var modal = document.getElementById('modal-options'); var buttonClose = document.getElementById('modal-btn-close'); if (typeof (getUrlVars()['ref_source']) !== 'undefined' && getUrlVars()['ref_source'] !== '') { _('modal-options').fade('in', 100); body.style.overflow = 'hidden'; } if (modal !== null) { modal.addEventListener('click', function() { _('modal-options').fade('out', 100); body.style.overflow = 'visible'; }); modal.querySelector('.modal-body').addEventListener('click', function(e) { e.stopPropagation(); }, false); buttonClose.addEventListener('click', function() { _('modal-options').fade('out', 100); body.style.overflow = 'visible'; }); document.addEventListener('keyup', function(e) { if (e.keyCode == 27) { _('modal-options').fade('out', 100); body.style.overflow = 'visible'; } }); } }); document.addEventListener('DOMContentLoaded', function() { var navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); if (navbarBurgers.length > 0) { navbarBurgers.forEach(function (el) { el.addEventListener('click', function () { var targetEl = el.dataset.target; var target = document.getElementById(targetEl); el.classList.toggle('is-active'); target.classList.toggle('is-active'); }); }); } }); document.addEventListener('DOMContentLoaded', function() { var swiper = new Swiper('.swiper-container', { autoplay: { delay: 3000, disableOnInteraction: false, }, breakpoints: { 1150: { slidesPerView: 4, }, 800: { slidesPerView: 2, }, 500: { slidesPerView: 1, }, }, centeredSlides: true, lazy: true, loop: true, navigation: { nextEl: '.swiper-next', prevEl: '.swiper-previous', }, slidesPerView: 5, spaceBetween: 0, }); });