-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
292 lines (249 loc) · 9.88 KB
/
index.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
const body = document.getElementById('root');
const mainWrapper = document.getElementById('main-wrapper');
const section = document.getElementById('section');
const article = document.getElementById('article');
const footer = document.querySelector('.adidas-footer');
const menDropdown = document.querySelector('.Men-Navigation-for-allLinks');
const womanDropdown = document.querySelector('.Woman-Navigation-for-allLinks');
const kidsDropdown = document.querySelector('.kids-Navigation-for-allLinks');
const salesDropdown = document.querySelector('.sales-Navigation-for-allLinks');
const salesOffData = document.querySelector("div[data-sales='sales']");
const salesUpperTop= document.querySelector('.upperTop-sales-info');
const closeSales= document.querySelector('.close-sales');
const header = document.querySelector('header');
const men = document.querySelector("a[href='/men']");
const kids = document.querySelector("a[href='/kids']");
const sales = document.querySelector("a[href='/sale']");
const woman = document.querySelector("a[href='/woman']");
const searchInput = document.getElementById("search");
const emailInput = document.getElementById("email");
const mobileMunuWrapper = document.querySelector(".icon-wrapper")
const mobileBarIcon = [...document.querySelectorAll(".menu")];
const mobileOpenSideMenu= document.querySelector(".mobile_Navigation");
const mobileCloseSideMenu = document.querySelector(".mane_closeLogo");
const userIcon = document.querySelector(".user-login");
const userLoginForm = document.querySelector(".user-login-form");
const cancelLoginForm = document.querySelector(".cancel");
const userAlertMsg = document.querySelector(".alert");
const quotes = document.getElementById('text-quote');
let index = 0
searchInput.addEventListener('focus', function(e) {
this.style.outline = `none`;
this.style.fontSize = '17px'
})
emailInput.addEventListener('focus', function(e) {
this.style.outline = `none`;
})
const closeDisplay = async () => {
menDropdown.style.cssText = `display:none;`;
men.style.cssText = `text-decoration:none;`;
woman.style.cssText = `text-decoration:none;`;
womanDropdown.style.cssText = `display:none;`;
}
salesOffData.addEventListener('click', function(e){
const width = window.innerWidth
if(width <= 954){
salesUpperTop.style.cssText = `
animation: upper-dropdown 1s cubic-bezier(0.95, 0.05, 0.795, 0.035) forwards;
transition: 10s linear; display:flex; position:fixed; height:100vh; overflow-y:scroll;`;
body.style.cssText = 'overflow-x:hidden;background:black;';
mainWrapper.style.display = 'none';
section.style.display = 'none';
article.style.display = 'none';
footer.style.display = 'none';
header.style.display = 'none'
}else{
salesUpperTop.style.cssText = `
animation: upper-dropdown 1s cubic-bezier(0.95, 0.05, 0.795, 0.035) forwards;
transition: 10s linear; display:flex; position:fixed; height:60vh; overflow-y:scroll;`;
body.style.cssText = `
overflow:hidden;background:black;`;
}
});
const close_Sales = async () => {
closeSales.addEventListener('click', (e) => {
salesUpperTop.style.cssText = 'display:none';
body.style.cssText = 'overflow:auto;';
section.style.display = '';
article.style.display = '';
footer.style.display = '';
mainWrapper.style.display = 'grid';
header.style.display = ''
})
}
close_Sales()
men.addEventListener('mouseover', async function(e){
menDropdown.style.cssText = `
animation: men-dropdown 1s cubic-bezier(0.895, 0.03, 0.685, 0.2) forwards;
transition: 10s linear;
display:flex; position:fixed;`;
womanDropdown.style.cssText = `display:none;`;
woman.style.cssText = `text-decoration:none;`;
kidsDropdown.style.cssText = `display:none;`;
kids.style.cssText = `text-decoration:none;`;
salesDropdown.style.cssText = `display:none;`;
sales.style.cssText = `text-decoration:none;`;
});
woman.addEventListener('mouseover', async function(e){
womanDropdown.style.cssText = `
animation: woman-dropdown 1s cubic-bezier(0.895, 0.03, 0.685, 0.2) forwards;
transition: 10s linear;
display:flex; position:fixed;
`;
menDropdown.style.cssText = `display:none;`;
men.style.cssText = `text-decoration:none;`;
kidsDropdown.style.cssText = `display:none;`;
kids.style.cssText = `text-decoration:none;`;
salesDropdown.style.cssText = `display:none;`;
sales.style.cssText = `text-decoration:none;`;
});
kids.addEventListener('mouseover', async function(e){
kidsDropdown.style.cssText = `
animation: kids-dropdown 1s cubic-bezier(0.895, 0.03, 0.685, 0.2) forwards;
transition: 10s linear;display:flex; position:fixed;`;
closeDisplay();
salesDropdown.style.cssText = `display:none;`;
sales.style.cssText = `text-decoration:none;`;
});
sales.addEventListener('mouseover', async function(e){
salesDropdown.style.cssText = `
animation: sales-dropdown 1s cubic-bezier(0.895, 0.03, 0.685, 0.2) forwards;
transition: 10s linear;display:flex; position:fixed;`;
closeDisplay();
kidsDropdown.style.cssText = `display:none;`;
kids.style.cssText = `text-decoration:none;`;
});
window.addEventListener('click', async function(e) {
closeDisplay()
kidsDropdown.style.cssText = `display:none;`;
kids.style.cssText = `text-decoration:none;`;
salesDropdown.style.cssText = `display:none;`;
sales.style.cssText = `text-decoration:none;`;
});
window.addEventListener('dblclick', async function(e) {
salesUpperTop.style.cssText = `display:none;`;
});
let changeText = async () => {
const text = [
'MID-SEASON SALE: UP TO 50% OFF',
'FREE STANDARD SHIPPING & RETURNS',
'UP TO 65% OFF WITH CODE: EXTRASALE'
]
index = index < text.length -1 ? ++index : 0;
salesOffData.textContent = `${text[index]}`;
const width = window.innerWidth
if(width >= 955){
salesOffData.insertAdjacentHTML('beforeend', "<span class='down-A'></span>");
}
}
setInterval(changeText, 8000);
window.addEventListener('resize',function(e){
const width = this.innerWidth
if(width >= 955){
mobileOpenSideMenu.style.cssText = `display:none;`;
this.document.body.style.overflow = 'auto';
}
});
function menuHover(){
const change = true;
const width = window.innerWidth
Array.from(mobileBarIcon).filter((currentElement) => {
switch (change){
case currentElement.classList.contains('icon-right') :
currentElement.style.cssText = `border-color: white;transition: all .20s linear; transform:rotatey(190deg)rotate(50deg);`;
break;
case currentElement.classList.contains('icon-middle') :
currentElement.style.cssText = `border-color: red;transition: all .20s linear; transform:rotatey(190deg)rotate(-179deg);`;
if(width >= 480){
currentElement.style.cssText = `animation: icon-middle 3s linear infinite;`;
}
break;
case currentElement.classList.contains('icon-left') :
currentElement.style.cssText = `border-color: white;transition: all .20s linear; transform:rotatey(190deg)rotate(-50deg);`;
break;
}
})
};
function menuClose(){
Array.from(mobileBarIcon).forEach(list => {
list.style.cssText = `border-color: white;transition: all .20s linear;`;
});
};
mobileMunuWrapper.addEventListener('click', function(e){
const width = window.innerWidth;
if(width <= 470){
mobileOpenSideMenu.style.cssText = `
animation: open-menu 1s ease forwards;transition: animation .7s linear;display:flex; overflow-y:scroll;`;
header.style.display = 'none'
body.style.cssText = 'overflow-y:scroll; overflow-x:hidden;background:#181818;';
mainWrapper.style.display = 'none'
section.style.display = 'none'
article.style.display = 'none'
footer.style.display = 'none'
}else{
mobileOpenSideMenu.style.cssText = `
animation: open-menu 1s ease forwards;transition: animation .7s linear;display:grid;overflow-y:scroll;overflow-x:hidden;`;
body.style.cssText = 'overflow-y:scroll; overflow-x:hidden;background:#181818';
mainWrapper.style.display = 'none';
section.style.display = 'none';
article.style.display = 'none';
footer.style.display = 'none';
header.style.display = 'none'
}
})
mobileCloseSideMenu.addEventListener('click', function(e){
mobileOpenSideMenu.style.cssText = `
animation: close-menu 4s ease forwards;transition: animation .20s linear;display:none;`
body.style.cssText = 'background:black;overflow:auto;';
mainWrapper.style.display = 'grid';
section.style.display = '';
article.style.display = '';
footer.style.display = '';
header.style.display = '';
})
mobileMunuWrapper.addEventListener('mouseover', function(e){
menuHover()
})
mobileMunuWrapper.addEventListener('mouseleave', function(e){
menuClose()
})
userIcon.addEventListener('click', (e) => {
userLoginForm.style.cssText = `
animation: user-login 1s cubic-bezier(0.445, 0.05, 0.55, 0.95) forwards;transition: animation .20s linear;display:flex;
`;
userAlertMsg.style.display = 'none'
});
userLoginForm.addEventListener('click', (e) => {
console.log(e)
})
cancelLoginForm.addEventListener('click', (e) => {
userLoginForm.style.cssText = `display:none;
`
})
var options = {
animate: true,
patternWidth: 100,
patternHeight: 100,
grainOpacity: 0.13,
grainDensity: 1,
grainWidth: 1,
grainHeight: 1
};
grained("#grain1", options);
grained("#grain2", options);
grained("#grain3", options);
grained("#grain4", options);
grained("#grain5", options);
grained("#grain6", options);
grained("#grain7", options);
grained("#grain8", options);
const grainCancel = async () => {
const width = window.innerWidth
if(width >= 460){
grained("#grain9", options);
}
if(width <= 460){
quotes.textContent = `It is totally impossible to be well-dressed in cheap shoes. Buy adidas.`;
}
}
grainCancel()