-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
149 lines (120 loc) · 4.72 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
AOS.init({
// Global settings:
disable: false, // accepts following values: 'phone', 'tablet', 'mobile', boolean, expression or function
startEvent: 'DOMContentLoaded', // name of the event dispatched on the document, that AOS should initialize on
initClassName: 'aos-init', // class applied after initialization
animatedClassName: 'aos-animate', // class applied on animation
useClassNames: false, // if true, will add content of `data-aos` as classes on scroll
disableMutationObserver: false, // disables automatic mutations' detections (advanced)
debounceDelay: 50, // the delay on debounce used while resizing window (advanced)
throttleDelay: 99, // the delay on throttle used while scrolling the page (advanced)
// Settings that can be overridden on per-element basis, by `data-aos-*` attributes:
offset: 80, // offset (in px) from the original trigger point
delay: 0, // values from 0 to 3000, with step 50ms
duration: 1000, // values from 0 to 3000, with step 50ms
easing: 'ease', // default easing for AOS animations
once: true, // whether animation should happen only once - while scrolling down
mirror: false, // whether elements should animate out while scrolling past them
anchorPlacement: 'top-bottom', // defines which position of the element regarding to window should trigger the animation
});
const portfolioProducts = document.querySelectorAll(".images");
const buttonsPortfolio = document.querySelectorAll(".images_button");
const startPortfolioProduct = document.querySelector(".images");
const anchors = document.querySelectorAll('a[href*="#"]');
const imagesOpen = document.querySelectorAll(".swiper-big .portfolio__products-item");
const modal = document.getElementById("modal1");
const closeButton = document.querySelector(".close");
const imageViewer = document.querySelector(".image-viewer__img");
const classButtonActive = "portfolio__menu-button__active";
startPortfolioProduct.style.display = "grid";
for (let el of imagesOpen) {
el.addEventListener("click", function (event) {
imageViewer.style.backgroundImage = this.style.backgroundImage;
modal.classList.add("image-viewer__active");
closeButton.addEventListener("click", closeModal);
modal.addEventListener("click", hideModal);
function closeModal() {
modal.classList.remove("image-viewer__active");
closeButton.removeEventListener("click", closeModal);
}
function hideModal(event) {
if (event.target === modal) {
closeModal();
}
}
})
}
for (let anchor of anchors) {
anchor.addEventListener("click", function (event) {
event.preventDefault();
const blockID = anchor.getAttribute("href");
document.querySelector(" " + blockID).scrollIntoView({
behavior: "smooth",
block: "start"
})
})
}
for (let el of buttonsPortfolio) {
el.onclick = function () {
switchProducts(this.dataset.filter, portfolioProducts, buttonsPortfolio, classButtonActive);
}
}
function switchProducts(filter, listStart, listFinish, classActive) {
for (let product of listStart) {
product.style.display = "none";
if (product.classList.contains(filter)) {
product.style.display = "grid";
}
}
for (let button of listFinish) {
if (button.dataset.filter === filter) {
button.classList.add(classActive);
} else {
button.classList.remove(classActive);
}
}
}
const swiperCervices = new Swiper('.swiper-container-cervices', {
// Optional parameters
direction: 'horizontal',
slidesPerView: 1,
spaceBetween: 20,
loop: true,
// If we need pagination
pagination: {
el: '.swiper-pagination-cervices',
},
});
const swiperLandscapes = new Swiper('.swiper-container', {
// Optional parameters
direction: 'horizontal',
slidesPerView: 1,
spaceBetween: 20,
loop: true,
// If we need pagination
pagination: {
el: '.swiper-pagination',
},
});
const swiperLogoDesign = new Swiper('.swiper-container-next', {
// Optional parameters
direction: 'horizontal',
slidesPerView: 1,
spaceBetween: 20,
loop: true,
// If we need pagination
pagination: {
el: '.logo-design',
},
});
const swiperUI = new Swiper('.swiper-container-more', {
// Optional parameters
direction: 'horizontal',
slidesPerView: 1,
spaceBetween: 20,
loop: true,
// If we need pagination
pagination: {
el: '.ui-design',
},
});