-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
472 lines (419 loc) · 15.5 KB
/
Copy pathscript.js
File metadata and controls
472 lines (419 loc) · 15.5 KB
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
// --------------for scrolling verticaly
window.addEventListener('scroll', function () {
const header = document.querySelector('header');
let scrollSec = document.getElementsByClassName('scrolly-nav')[0];
let windowPosition = window.scrollY > 0;
header.classList.toggle('scrolling-active', windowPosition);
scrollSec.classList.toggle('scrolly-short', windowPosition);
guestsBTN.classList.remove("showGuestBTN", windowPosition);
pinkSearch.classList.remove("searchShowG", windowPosition);
pinkSearch.classList.remove("searchShow", windowPosition);
guedtsDD.classList.remove("guedtsDDshow", windowPosition);
scrollExp.classList.remove("showExperience", windowPosition);
guestss.addEventListener('click', function () {
header.classList.add('scrollyClick');
scrollSec.classList.add('scrolly-short-click');
});
let windowPositionClose = window.scrollY == 0;
header.classList.remove('scrollyClick' , windowPositionClose);
scrollSec.classList.remove('scrolly-short-click' , windowPositionClose);
});
// close small nav
// FUNCTION WHEN WE CLICCK ON NAVBAR IN SMALLDEVICE
const smallNav = document.getElementsByClassName('scrolly-nav')[0];
const smallHeader = document.querySelector('header');
const SmallLoc = document.querySelector('.location');
function openNavS() {
smallNav.classList.toggle("showSmallNavDD");
smallHeader.classList.toggle("showSmallHeaderDD");
}
// function for clode dropdown in small nav
// closeIcon = document.querySelector('.close-icon');
// closeIcon.addEventListener('click', CloseIt());
// function CloseIt(){
// smallHeader.classList.remove("showSmallHeaderDD");
// smallNav.classList.remove("showSmallNavDD");
// }
// function closeIconNav (){
// smallHeader.classList.remove("showSmallHeaderDD");
// smallNav.classList.remove("showSmallNavDD");
// }
// back to place to stay
const placesToStay = document.querySelector(".nav-list1");
let scrollyNPlaces = document.getElementsByClassName('scrolly-nav')[0];
function firstTab() {
scrollExp.classList.remove("showExperience");
}
// experience tab
const experienceTab = document.querySelector('.nav-list2');
const ExperienceTab1 = document.querySelector('.ExperienceTab1');
const ExperienceTab2 = document.querySelector('.ExperienceTab2');
const DateDD = document.querySelector("#LocDropdown");
const scrollExp = document.getElementsByClassName('scrolly-nav')[0];
const pinkSearchDD = document.querySelector(".search-DD");
// experience tab
function showExperience() {
scrollExp.classList.add("showExperience");
}
// experience date tab
function showDataExp() {
ExperienceTab2.classList.add("showDateBTN");
pinkSearchDD.classList.add("searchShowDDD");
}
// experience location tab
function showLocExp() {
DateDD.classList.add("activeFlex");
ExperienceTab1.classList.add("showLocationBTN");
pinkSearchDD.classList.add("searchShowDD");
}
// underline for navbar item
const navLi1 = document.querySelector(".nav-list1");
const navUL = document.querySelector(".nav-list");
function openItem(event) {
tabItem = document.getElementsByClassName("nav-list-i");
for (i = 0; i < tabItem.length; i++) {
tabItem[i].className = tabItem[i].className.replace(" ShowUnderline", "");
}
event.currentTarget.className += " ShowUnderline";
}
// ----------------for opening signin dropdowns
const userdd = document.querySelector("#userDropDown");
const userddBTN = document.querySelector("#user-menu-right");
function userMenuDropdown() {
userdd.classList.toggle("show");
}
// ----------- scrolly const
const locationn = document.querySelector(".locationDD");
const locationBTN = document.querySelector(".location");
const checkinn = document.querySelector(".checkin");
const checkoutt = document.querySelector(".checkout");
const guestss = document.querySelector(".guests");
const guestsBTN = document.querySelector(".guests");
const guedtsDD = document.querySelector(".guestsDD");
const pinkSearch = document.querySelector(".search-icon");
// const checkDD = document.querySelector(".check-container");
const flexibleBTN = document.querySelector(".c-TAB2");
const CalendarBTN = document.querySelector(".c-TAB1");
// const checkContent = document.querySelector("check-main");
const calContent = document.querySelector("calendar-content");
const flexContent = document.querySelector("flexible-content")
// --------------------location dropdown
function showLocationF() {
locationn.classList.add("showLocation");
locationBTN.classList.add("showLocationBTN");
checkinn.classList.add("checkinSEC");
checkoutt.classList.add("checkoutSEC");
guestss.classList.add("guestsSEC");
pinkSearch.classList.add("searchShow");
}
// ---------------------checkin dropdown
function showCheckinF() {
pinkSearch.classList.add("searchShowIN");
checkinn.classList.add("ShowCheckinBTN");
// checkDD.classList.add("activeFlex-Check");
}
// ---------------------checkout dropdown
function showCheckoutF() {
pinkSearch.classList.add("searchShowOUT");
checkoutt.classList.add("ShowCheckoutBTN");
// checkDD.classList.add("activeFlex-Check");
}
// fuction for open I'm flexible tab
function showTABF(){
flexibleBTN.classList.add("showFlexibleBTN");
calContent.classList.add("closeTabc");
flexContent.classList.add("showTabF")
CalendarBTN.classList.remove("showCalendarBTN");
}
// fuction for close I'm flexible tab
function showTABC(){
CalendarBTN.classList.add("showCalendarBTN");
flexibleBTN.classList.remove("showFlexibleBTN");
calContent.classList.remove("closeTabc");
flexContent.classList.remove("showTabF")
}
// ---------------------guests dropdown
function showGuestsF() {
guestsBTN.classList.add("showGuestBTN");
pinkSearch.classList.add("searchShowG");
guedtsDD.classList.add("guedtsDDshow");
checkoutt.classList.add("checkoutSECBRD");
checkinn.classList.add("checkinG");
checkoutt.classList.add("checkoutG");
locationBTN.classList.add("locationG");
}
// --------closer dropdown of signin btn
$(document).click(function (event) {
// for location experience
if ((!$(event.target).closest(DateDD).length) && (!$(event.target).closest(ExperienceTab1).length)) {
DateDD.classList.remove("activeFlex");
ExperienceTab1.classList.remove("showLocationBTN");
pinkSearchDD.classList.remove("searchShowDD");
}
if ((!$(event.target).closest(ExperienceTab2).length) && (!$(event.target).closest(ExperienceTab2).length)) {
pinkSearchDD.classList.remove("searchShowDDD");
ExperienceTab2.classList.remove("showDateBTN");
}
// for signin
if ((!$(event.target).closest(userdd).length) && (!$(event.target).closest(userddBTN).length)) {
userdd.classList.remove("show");
}
// for location
if ((!$(event.target).closest(locationn).length) && (!$(event.target).closest(locationBTN).length)) {
locationn.classList.remove("showLocation");
locationBTN.classList.remove("showLocationBTN");
checkinn.classList.remove("checkinSEC");
checkoutt.classList.remove("checkoutSEC");
pinkSearch.classList.remove("searchShow");
}
// for guests
if ((!$(event.target).closest(guedtsDD).length) && (!$(event.target).closest(guestsBTN).length)) {
guestsBTN.classList.remove("showGuestBTN");
pinkSearch.classList.remove("searchShowG");
guedtsDD.classList.remove("guedtsDDshow");
checkoutt.classList.remove("checkoutSECBRD");
checkinn.classList.remove("checkinG");
checkoutt.classList.remove("checkoutG");
locationBTN.classList.remove("locationG");
}
// for checkin and checkout
if ((!$(event.target).closest(checkoutt).length) && (!$(event.target).closest(checkinn).length)) {
pinkSearch.classList.remove("searchShowOUT");
pinkSearch.classList.remove("searchShowIN");
// checkDD.classList.remove("activeFlex-Check");
}
if(!$(event.target).closest(checkoutt).length){
checkoutt.classList.remove("ShowCheckoutBTN");
}
if(!$(event.target).closest(checkinn).length){
checkinn.classList.remove("ShowCheckinBTN");
}
});
// ------------- child counter --------------------------
const childCoun = document.querySelector(".childrenNum");
const decChild = document.querySelector(".decBtnChild");
const incChild = document.querySelector(".IncBtnChild");
let countervalueC = 0;
// ----for increase
incChild.addEventListener('click', function (event) {
if (countervalueC < 5) {
countervalueC += 1;
childCoun.innerHTML = countervalueC;
incChild.classList.remove("forbiddenIcon");
} else {
incChild.classList.add("forbiddenIcon");
}
});
//-----for decrease
decChild.addEventListener('click', function (event) {
if (countervalueC > 0) {
countervalueC -= 1;
childCoun.innerHTML = countervalueC;
decChild.classList.remove("forbiddenIcon");
} else {
decChild.classList.add("forbiddenIcon");
}
});
// ------------- Infants counter --------------------------
const InfantsNum = document.querySelector(".InfantsNum");
const decInfants = document.querySelector(".decBtnInfants");
const incInfants = document.querySelector(".IncBtnInfants");
let countervalueI = 0;
// ----for increase
incInfants.addEventListener('click', function (event) {
if (countervalueI < 5) {
countervalueI += 1;
InfantsNum.innerHTML = countervalueI;
incInfants.classList.remove("forbiddenIcon");
} else {
incInfants.classList.add("forbiddenIcon");
}
});
//-----for decrease
decInfants.addEventListener('click', function (event) {
if (countervalueI > 0) {
countervalueI -= 1;
InfantsNum.innerHTML = countervalueI;
decInfants.classList.remove("forbiddenIcon");
} else {
decInfants.classList.add("forbiddenIcon");
}
});
// ------------- Adult counter ----------------------------------
const adualtCoun = document.querySelector(".adultNum");
const decAdualt = document.querySelector(".decBtnAdults");
const incAdualt = document.querySelector(".IncBtnAdults");
let countervalueA = 0;
// ----for increase
incAdualt.addEventListener('click', function (event) {
if (countervalueA < 15) {
countervalueA += 1;
adualtCoun.innerHTML = countervalueA;
incAdualt.classList.remove("forbiddenIcon");
} else {
incAdualt.classList.add("forbiddenIcon");
}
});
//-----for decrease
decAdualt.addEventListener('click', function (event) {
if (countervalueA > 0) {
countervalueA -= 1;
adualtCoun.innerHTML = countervalueA;
decAdualt.classList.remove("forbiddenIcon");
} else {
decAdualt.classList.add("forbiddenIcon");
}
});
//swiper slider
var swiper = new Swiper(".mySwiper", {
slidesPerView: 3,
spaceBetween: 10,
freeMode: true,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
}
});
var swiper = new Swiper(".my2Swiper", {
slidesPerView: "auto",
spaceBetween: 10,
freeMode: true,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
}
});
//modal
var modalMoneyContent = document.getElementById("modal__container-money")
var modalLangContent = document.getElementById("modal__container-lang")
var modalExploreContent = document.getElementById("modal__container-explore")
var overlayclose = document.getElementById('overlay')
var overlaycloseLan = document.getElementById('overlay-lang')
var overlaycloseExplore = document.getElementById('overlay-explore')
var modalMoneyBtn = document.getElementById("modal-money-btn")
modalMoneyBtn.addEventListener("click", () => {
modalMoneyContent.style.display = "block";
})
$('#modal-explore-btn').click(function () {
modalExploreContent.style.display = "block";
})
$("#close-money").click(function () {
modalMoneyContent.style.display = "none";
})
$("#close-lang").click(function () {
modalLangContent.style.display = "none";
})
$("#close-explore").click(function () {
modalExploreContent.style.display = "none";
})
$('#modal-lang-btn').click(function () {
modalLangContent.style.display = "block";
})
// When the user clicks anywhere outside of the modal, close it
$(document).click(function (event) {
if (event.target == overlayclose || event.target == overlaycloseLan || event.target == overlaycloseExplore) {
modalMoneyContent.style.display = "none";
modalLangContent.style.display = "none";
modalExploreContent.style.display = "none";
}
})
// hide nav footer
let pointFooter = document.getElementById("point-offset");
let pointOffset = pointFooter.offsetTop;
window.onscroll = function() {
if (window.pageYOffset < pointOffset) {
document.getElementById("navbar").style.bottom = "0";
} else {
//if windows offset greater than distance of that specific elment to top ,hide navbar in bottom
document.getElementById("navbar").style.bottom = "-100px";
}
}
//top of footer
btnTab = document.getElementsByClassName("tab-btn")
function openCity(evt, Cityname) {
var i, tabcontent, tablinks;
tablinks = document.getElementsByClassName("tab-btn");
tabcontent = document.getElementsByClassName("tab-content");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
evt.currentTarget.className += " active";
document.getElementById(Cityname).style.display = "flex";
}
//explore btn
function openOption(evt, Optionname) {
var i, tabcontent, tablinks;
tablinks = document.getElementsByClassName("tab-btn");
tabcontent = document.getElementsByClassName("tab-content-1");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
evt.currentTarget.className += " active";
document.getElementById(Optionname).style.display = "flex";
}
// // calendar configuration
// configObject = {
// autoClose: false,
// format: 'YYYY-MM-DD',
// separator: ' to ',
// language: 'auto',
// startOfWeek: 'sunday',// or monday
// getValue: function () {
// return $(this).val();
// },
// setValue: function (s) {
// if (!$(this).attr('readonly') && !$(this).is(':disabled') && s != $(this).val()) {
// $(this).val(s);
// }
// },
// startDate: false,
// endDate: false,
// time: {
// enabled: false
// },
// minDays: 0,
// maxDays: 0,
// showShortcuts: false,
// shortcuts:
// {
// //'prev-days': [1,3,5,7],
// //'next-days': [3,5,7],
// //'prev' : ['week','month','year'],
// //'next' : ['week','month','year']
// },
// customShortcuts: [],
// inline: false,
// container: 'body',
// alwaysOpen: false,
// singleDate: false,
// lookBehind: false,
// batchMode: false,
// duration: 200,
// stickyMonths: false,
// dayDivAttrs: [],
// dayTdAttrs: [],
// applyBtnClass: '',
// singleMonth: 'auto',
// hoveringTooltip: function (days, startTime, hoveringTime) {
// return days > 1 ? days + ' ' + lang('days') : '';
// },
// showTopbar: true,
// swapTime: false,
// selectForward: false,
// selectBackward: false,
// showWeekNumbers: false,
// getWeekNumber: function (date) //date will be the first day of a week
// {
// return moment(date).format('w');
// },
// monthSelect: false,
// yearSelect: false
// }
// //calendar js
// $('#dom-id').dateRangePicker(configObject);