-
Notifications
You must be signed in to change notification settings - Fork 350
/
dubai.html
332 lines (295 loc) · 10.6 KB
/
dubai.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dubai Travel - Hotels</title>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="./styles/popup.css">
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Pattaya&family=Poppins:wght@400;500&display=swap"
rel="stylesheet"
/>
<script src="https://kit.fontawesome.com/c4254e24a8.js" crossorigin="anonymous"></script>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
width: 100vw;
display: flex;
flex-direction: column;
align-items: center;
overflow-x: hidden;
}
.main-image {
width: 100%;
height: 300px;
object-fit: cover;
background-image: url('https://images.pexels.com/photos/3763190/pexels-photo-3763190.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2');
background-position: bottom;
}
.main-heading {
font-size: 48px;
color: white;
text-align: center;
height: 500px;
padding-top: 120px;
}
.top-container {
width: 100vw;
display: flex;
flex-direction: row;
justify-content: center;
}
.container {
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
margin: auto;
width: 100vw;
}
.seach-container {
margin-right: 40px;
}
.sort-container {
margin-left: 40px;
}
.card-container {
display: flex;
flex-wrap: wrap;
flex-direction: row;
width: 100vw;
height: 590px;
align-items: center;
margin: auto;
margin-left: 100px;
margin-bottom: 50px;
}
h1 {
color: #2c3e50;
margin-bottom: 30px;
font-size: 5em;
}
.hotel-card {
background-color: #ffffff;
border: 1px solid #ddd;
border-radius: 8px;
padding: 20px;
margin: 15px 40px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
width: 450px;
height: 100%;
}
.hotel-image {
width: 100%;
max-height: 400px;
border-radius: 8px;
object-fit: cover;
height: 100%;
}
.hotel-card h2 {
color: #2980b9;
margin: 10px 0 10px;
font-size: 3rem;
}
.hotel-card p {
color: #7f8c8d;
font-size: 18px;
}
.book-button {
background-color: #2980b9;
color: white;
border: none;
border-radius: 5px;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s;
}
.book-button:hover {
background-color: #1a6d99;
}
</style>
</head>
<body>
<div class="main-image">
<h1 class="main-heading">Dubai</h1>
<!-- <img src="https://images.pexels.com/photos/325193/pexels-photo-325193.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" alt="Dubai" class="img-fluid"> -->
</div>
<br>
<br>
<h1>Top Hotels in Dubai</h1>
<!-- Search Bar -->
<div class="top-container">
<div class="search-container">
<label for="search">Search for hotels:</label>
<input type="search" id="search" placeholder="Search for a hotel..." />
</div>
<div class="sort-container">
<label for="sort">Sort by Price:</label>
<select id="sort" name="sort">
<option value="featured">Featured</option>
<option value="low-to-high">Low to High</option>
<option value="high-to-low">High to Low</option>
</select>
</div>
</div>
<!-- Hotels -->
<div class="container">
<div class="card-container">
<div class="hotel-card">
<img
src="https://images.pexels.com/photos/2041556/pexels-photo-2041556.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
alt="Burj Al Arab"
class="hotel-image"
/>
<h2>Burj Al Arab</h2>
<p>Price per night: ₹84,000</p>
<button class="book-button">Book Now</button>
</div>
<div class="hotel-card">
<img
src="https://images.pexels.com/photos/19192777/pexels-photo-19192777/free-photo-of-atlantis-hotel-in-dubai.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
alt="Atlantis The Palm"
class="hotel-image"
/>
<h2>Atlantis The Palm</h2>
<p>Price per night: ₹42,000</p>
<button class="book-button">Book Now</button>
</div>
<div class="hotel-card">
<img
src="https://images.pexels.com/photos/1707310/pexels-photo-1707310.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
alt="Armani Hotel Dubai"
class="hotel-image"
/>
<h2>Armani Hotel Dubai</h2>
<p>Price per night: ₹58,000</p>
<button class="book-button">Book Now</button>
</div>
</div>
<div class="card-container">
<div class="hotel-card">
<img src="https://images.pexels.com/photos/29080602/pexels-photo-29080602/free-photo-of-luxury-poolside-view-with-dubai-skyline.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" alt="The Ritz-Carlton Dubai" class="hotel-image">
<h2>The Ritz-Carlton Dubai</h2>
<p>Price per night: ₹67,000</p>
<button class="book-button">Book Now</button>
</div>
<div class="hotel-card">
<img src="https://images.pexels.com/photos/10902477/pexels-photo-10902477.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" alt="Palace Downtown Dubai" class="hotel-image">
<h2>Palace Downtown Dubai</h2>
<p>Price per night: ₹75,000</p>
<button class="book-button">Book Now</button>
</div>
<div class="hotel-card">
<img src="https://images.pexels.com/photos/5075075/pexels-photo-5075075.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" alt="The Address Dubai Mall" class="hotel-image">
<h2>The Address Dubai Mall</h2>
<p>Price per night: ₹33,000</p>
<button class="book-button">Book Now</button>
</div>
</div>
<div class="card-container">
<div class="hotel-card">
<img src="https://images.pexels.com/photos/14788516/pexels-photo-14788516.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" alt="Grand Hyatt Dubai" class="hotel-image">
<h2>Grand Hyatt Dubai</h2>
<p>Price per night: ₹46,000</p>
<button class="book-button">Book Now</button>
</div>
<div class="hotel-card">
<img src="https://images.pexels.com/photos/12238320/pexels-photo-12238320.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" alt="Shangri-La Hotel Dubai" class="hotel-image">
<h2>Shangri-La Hotel Dubai</h2>
<p>Price per night: ₹54,000</p>
<button class="book-button">Book Now</button>
</div>
<div class="hotel-card">
<img src="https://images.pexels.com/photos/16422487/pexels-photo-16422487/free-photo-of-jumeirah-emirate-towers-in-dubai.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" alt="Shangri-La Hotel Dubai" class="hotel-image">
<h2>Jumeirah Emirates Towers</h2>
<p>Price per night: ₹25,000</p>
<button class="book-button">Book Now</button>
</div>
</div>
</div>
</div>
<!-- Sorting Script -->
<script>
const hotelCards = document.querySelectorAll(".hotel-card");
const sortSelect = document.getElementById("sort");
const searchInput = document.getElementById("search");
// Function to filter hotel cards based on search input
function filterHotels() {
const searchTerm = searchInput.value.toLowerCase();
const matchedHotels = []; // Array to store matched hotel cards
hotelCards.forEach((hotelCard) => {
const hotelName = hotelCard
.querySelector("h2")
.textContent.toLowerCase();
if (hotelName.includes(searchTerm)) {
matchedHotels.push(hotelCard); // Add matching hotel card to the array
}
});
// Clear the card container
const cardContainer = document.querySelector(".card-container");
cardContainer.innerHTML = "";
// Append matched hotels to the card container in rows of three
matchedHotels.forEach((hotelCard) => {
cardContainer.appendChild(hotelCard);
});
}
// Add event listener to search input
searchInput.addEventListener("input", filterHotels);
sortSelect.addEventListener("change", () => {
const sortBy = sortSelect.value;
let sortedHotels;
if (sortBy === "featured") {
window.location.reload(true);
return false;
}
if (sortBy === "low-to-high") {
sortedHotels = [...hotelCards].sort((a, b) => {
const priceA = parseInt(
a
.querySelector("p")
.textContent.replace("Price per night: ₹", "")
);
const priceB = parseInt(
b
.querySelector("p")
.textContent.replace("Price per night: ₹", "")
);
return priceA - priceB;
});
} else if (sortBy === "high-to-low") {
sortedHotels = [...hotelCards].sort((a, b) => {
const priceA = parseInt(
a
.querySelector("p")
.textContent.replace("Price per night: ₹", "")
);
const priceB = parseInt(
b
.querySelector("p")
.textContent.replace("Price per night: ₹", "")
);
return priceB - priceA;
});
}
const cardContainer = document.querySelector(".card-container");
cardContainer.innerHTML = "";
sortedHotels.forEach((hotelCard) => {
cardContainer.appendChild(hotelCard);
});
});
</script>
</body>
</html>