eda/build/static/js/main.js
2020-08-24 08:14:45 +03:00

76 lines
1.8 KiB
JavaScript

"use strict";
if (window.matchMedia("(max-width: 954px)").matches) {
var popup_filter = document.getElementById('popup-filter');
var cart_x = document.getElementById('cartx');
var html_tag = document.getElementsByTagName('html')[0];
var priceblock = document.getElementsByClassName('priceblock')[0];
var popup = document.getElementsByClassName('popup')[0];
priceblock.onclick = function () {
// блюрим и запрещаем управление сайтом
html_tag.classList.toggle('open-modal');
popup.classList.toggle('open-popup');
cart_x.classList.toggle('side-open');
};
}
new Glide('.glide', {
type: 'carousel',
startAt: 0,
perView: 3,
gap: 40,
rewindDuration: 2000,
animationDuration: 1000,
breakpoints: {
1200: {
perView: 1
},
640: {
perView: 1
}
}
}).mount(); // forEach IE 11
if ('NodeList' in window && !NodeList.prototype.forEach) {
console.info('polyfill for IE11');
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
} // closest IE 11
(function () {
if (!Element.prototype.closest) {
Element.prototype.closest = function (css) {
var node = this;
while (node) {
if (node.matches(css)) return node;else node = node.parentElement;
}
return null;
};
}
})(); // matches IE 11
(function () {
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.webkitMatchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector;
}
})(); //Array.form IE 11
if (!Array.from) {
Array.from = function (object) {
'use strict';
return [].slice.call(object);
};
}