-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
80 lines (75 loc) · 1.89 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* */
(function () {
"use strict";
// Easy selector helper function
const select = (el, all = false) => {
el = el.trim()
if (all) {
return [...document.querySelectorAll(el)]
} else {
return document.querySelector(el)
}
}
// Easy event listener function
const on = (type, el, listener, all = false) => {
let selectEl = select(el, all)
if (selectEl) {
if (all) {
selectEl.forEach(e => e.addEventListener(type, listener))
} else {
selectEl.addEventListener(type, listener)
}
}
}
// Menu isotope and filter
window.addEventListener('load', () => {
let menuContainer = select('.menu-container');
if (menuContainer) {
let menuIsotope = new Isotope(menuContainer, {
itemSelector: '.menu-item',
layoutMode: 'fitRows'
});
let menuFilters = select('#menu-flters li', true);
on('click', '#menu-flters li', function (e) {
e.preventDefault();
menuFilters.forEach(function (el) {
el.classList.remove('filter-active');
});
this.classList.add('filter-active');
menuIsotope.arrange({
filter: this.getAttribute('data-filter')
});
}, true);
}
});
// Events Slider
new Swiper('.events-slider', {
speed: 600,
loop: true,
autoplay: {
delay: 5000,
disableOnInteraction: false
},
slidesPerView: 'auto',
pagination: {
el: '.swiper-pagination',
type: 'bullets',
clickable: true
}
});
// Testimonials slider
new Swiper('.testimonials-slider', {
speed: 600,
loop: true,
autoplay: {
delay: 5000,
disableOnInteraction: false
},
slidesPerView: 'auto',
pagination: {
el: '.swiper-pagination',
type: 'bullets',
clickable: true
}
});
})()