-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
416 lines (371 loc) · 11.5 KB
/
index.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Amazon</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="./style.css">
<link rel="icon" type="image/x-icon" href="./images/icons/amazon-favicon.svg">
</head>
<body>
<header>
<div class="navbar">
<!-- Logo -->
<div class="nav-logo border">
<div class="logo"></div>
</div>
<!-- Address -->
<div class="nav-addr border">
<p>Deliver to</p>
<div class="addr-icon">
<i class="fa-solid fa-location-dot"></i>
<p>India</p>
</div>
</div>
<!-- Search bar -->
<section class="search-bar">
<select class="drop-down-btn">
<option>All</option>
<!-- <option>Something</option> -->
<i class="fa-solid fa-caret-down"></i>
</selectn>
<input type="text" class="search-input" placeholder="Search Amazon"/>
<button class="search-btn">
<i class="fa-solid fa-magnifying-glass"></i>
</button>
</section>
<!-- Country -->
<div class="country-cont border">
<img src="images/india.png" id="flag"/>
<p>IN</p>
<i class="fa-solid fa-caret-down"></i>
</div>
<!-- Sign-in -->
<div class="signin-cont border">
<p>Hello, sign in</p>
<p>
Accounts & Lists
<i class="fa-solid fa-caret-down"></i>
</p>
</div>
<!-- Returns -->
<div class="returns-cont border">
<p>Returns</p>
<p>& Orders</p>
</div>
<!-- Cart -->
<div class="cart-cont border" onclick=run()>
<i class="fa-solid fa-cart-shopping"></i>
<!-- <p class="cart-count">0</p> -->
<p class="cart-text">Cart</p>
</div>
</div>
<!-- panel -->
<div class="panel">
<div class="panel-all border">
<i class="fa-solid fa-bars"></i>
<a href="#">All</a>
</div>
<div class="panel-options">
<div class="border"><a href="#">Fresh</a></div>
<div class="border"><a href="#">Amazon Pay</a></div>
<div class="border"><a href="#">Gift Cards</a></div>
<div class="border"><a href="#">New Releases</a></div>
<div class="border"><a href="#">Amazon miniTV</a></div>
<div class="border"><a href="#">Sell</a></div>
<div class="border"><a href="#">Buy Again</a></div>
<div class="border"><a href="#">Gift Ideas</a></div>
<div class="border"><a href="#">Health, Household & Personal Care</a></div>
<div class="border"><a href="#">Coupens</a></div>
<div class="border"><a href="#">AmazonBasics</a></div>
<div class="border"><a href="#">Home Improvement</a></div>
<div class="border"><a href="#">Baby</a></div>
</div>
<!-- <div class="panel-deals">
Shop deals in Electronics
</div> -->
</div>
</header>
<div class="hero">
<div class="hero-msg">
<p>You are on amazon.com. You can also shop on Amazon India for millions of products with fast local delivery. <a href="#">Click here to go to amazon.in</a></p>
</div>
</div>
<div class="content">
<div class="card">
<h1 class="card-heading">Gaming accessories</h1>
<div class="card-content">
<div class="card-sm">
<img src="./images/games1.jpg" alt="">
<p class="product-description">Headsets</p>
</div>
<div class="card-sm">
<img src="./images/games2.jpg" alt="">
<p class="product-description">Gaming chair</p>
</div>
<div class="card-sm">
<img src="./images/games3.jpg" alt="">
<p class="product-description">Keyboards</p>
</div>
<div class="card-sm">
<img src="./images/games4.jpg" alt="">
<p class="product-description">Mouse</p>
</div>
</div>
<a href="#">See more</a>
</div>
<div class="card">
<h1 class="card-heading">Top deals</h1>
<div class="card-content card-top-deal">
<div class="card-md">
<img src="./images/mobile1.jpg" alt="">
<span class="card-sm-discount">5% off on mobile phones</span>
<p class="product-description">Today only: Save big on mobile phones</p>
</div>
</div>
<a href="#">See more</a>
</div>
<div class="card">
<h1 class="card-heading">Shop deals in fashion</h1>
<div class="card-content">
<div class="card-sm">
<img src="./images/clothes1.jpg" alt="">
<p class="product-description">Top</p>
</div>
<div class="card-sm">
<img src="./images/clothes2.jpg" alt="">
<p class="product-description">Jeans</p>
</div>
<div class="card-sm">
<img src="./images/clothes3.jpg" alt="">
<p class="product-description">T-shirts</p>
</div>
<div class="card-sm">
<img src="./images/clothes4.jpg" alt="">
<p class="product-description">Single piece</p>
</div>
</div>
<a href="#">See more</a>
</div>
<div class="sign-in-container">
<div class="sign-in-card">
<h1 class="card-heading">Sign in for best experience</h1>
<button id="sign-in-btn">Sign-in securely</button>
</div>
</div>
<div class="card">
<h1 class="card-heading">Beauty Picks</h1>
<div class="card-content">
<div class="card-md">
<img class="image-fill" src="./images/box5_image.jpg" alt="">
</div>
</div>
<a href="#">See more</a>
</div>
<div class="card">
<h1 class="card-heading">Pet care</h1>
<div class="card-content">
<div class="card-md">
<img class="image-fill" src="./images/box6_image.jpg" alt="">
</div>
</div>
<a href="#">See more</a>
</div>
<div class="card">
<h1 class="card-heading">New Arrivals in Toys</h1>
<div class="card-content">
<div class="card-md">
<img class="image-fill" src="./images/box7_image.jpg" alt="">
</div>
</div>
<a href="#">See more</a>
</div>
<div class="card">
<h1 class="card-heading">Discover Fashion Trends</h1>
<div class="card-content">
<div class="card-md">
<img class="image-fill" src="./images/box1_image.jpg" alt="">
</div>
</div>
<a href="#">See more</a>
</div>
<div class="flight-container">
<img src="images/flight.jpg" />
</div>
<div class="ph-hr-outer-container">
<h2 class="card-heading">Top deals on mobile phones</h2>
<div class="ph-hr-img-container">
<img src="images/phone1.jpg" alt="Phone1 Image" />
<img src="images/phone2.jpg" alt="Phone1 Image" />
<img src="images/phone3.jpg" alt="Phone1 Image" />
<img src="images/phone4.jpg" alt="Phone1 Image" />
<img src="images/phone5.jpg" alt="Phone1 Image" />
<img src="images/phone6.jpg" alt="Phone1 Image" />
<img src="images/phone7.jpg" alt="Phone1 Image" />
</div>
</div>
</div>
<footer>
<div class="back-to-top">
Back to top
</div>
<div class="footer-quick-links">
<div>
<ul>
<p>Get to Know Us</p>
<a>About Us</a>
<a>Careers</a>
<a>Press Releases</a>
<a>Amazon Science</a>
</ul>
</div>
<div>
<ul>
<p>Connect with Us</p>
<a>Facebook</a>
<a>Twitter</a>
<a>Instagram</a>
</ul>
</div>
<div>
<ul>
<p>Make Money with Us</p>
<a>Sell on Amazon</a>
<a>Sell under Amazon Accelerator</a>
<a>Protect and Build Your Brand</a>
<a>Amazon Global Selling</a>
<a>Become an Affiliate</a>
<a>Fulfilment by Amazon</a>
<a>Advertise Your Products</a>
<a>Amazon Pay on Merchants</a>
</ul>
</div>
<div>
<ul>
<p>Let Us Help You</p>
<a>COVID-19 and Amazon</a>
<a>Your Account</a>
<a>Returns Centre</a>
<a>100% Purchase Protection</a>
<a>Amazon App Download</a>
<a>Help</a>
</ul>
</div>
</div>
<div class="footer-logo-div">
<div class="footer-logo"></div>
</div>
<div class="terms">
<ul>
<li><a href="#">Conditions of Use & Sale</a></li>
<li><a href="#">Privacy Notice</a></li>
<li><a href="#">Interest-Based Ads</a></li>
</ul>
<div>
© 1996-2023, Amazon.com, Inc. or its affiliates
</div>
</div>
</footer>
<div class="credits-container hidden">
<credits>Developed by</credits>
<name>Harsh</name>
</div>
</body>
<script>
function run() {
alert("Your cart is empty");
}
document.addEventListener("DOMContentLoaded", function() {
// ----- HEADER PANNEL OPTIONS WITH REDUCED SCREEN SIZE --------
addWithAttToPanelOptions();
removeHiddenPannelOptions();
if (document.body.scrollWidth < 768) {
// alert("FOR BEST VIEW:- \n\nThis website is best viewed on Desktop screen size. \n\nOn mobile phones, you'll need to scroll horizontally at some positions.")
setTimeout(() => {
document.querySelector('.navbar').classList.add('moreWidth','move');
}, 500)
setTimeout(() => {
document.querySelector('.navbar').classList.remove('move');
}, 800);
setTimeout(() => {
document.querySelector('.navbar').classList.remove('moreWidth');
},1100)
setTimeout(() => {
document.querySelector('.panel').classList.add('moreWidth','move');
}, 1100)
setTimeout(() => {
document.querySelector('.panel').classList.remove('move');
}, 1400);
setTimeout(() => {
document.querySelector('.panel').classList.remove('moreWidth');
},1700)
}
// ---- Scroll to top - button functionality --------
document.getElementsByClassName('back-to-top')[0]
.addEventListener('click', () => {
window.scrollTo({ top: 0, behavior: 'smooth'})
})
// ----- Fix # issue from <a> tags
let allLinkTags = document.querySelectorAll('a')
allLinkTags.forEach(tag => {
let href = tag.getAttribute('href');
if (href == null || href == '#') {
tag.addEventListener('click', (e) => {
e.preventDefault();
})
}
})
});
function addWithAttToPanelOptions() {
const allDivs = document.querySelector('.panel-options')
.querySelectorAll('div');
allDivs.forEach(div => {
const width = div.getBoundingClientRect().width;
div.setAttribute('data-width', width)
})
}
window.addEventListener('resize', () => {
removeHiddenPannelOptions();
});
window.addEventListener('scroll', function() {
let pageHeight = document.body.scrollHeight;
let scrollPosition = window.innerHeight + window.scrollY;
let offsetFromBottom = (() => {
return (document.body.scrollWidth < 768)
? 1000
: 300;
})()
let targetScrollPosition = pageHeight - offsetFromBottom;
let el = document.getElementsByClassName('credits-container')[0];
if (scrollPosition > targetScrollPosition) {
el.classList.remove('hidden');
} else {
el.classList.add('hidden');
}
})
function removeHiddenPannelOptions() {
if (window.innerWidth < 768) return; // "Keep" the scroll bar for smaller screens
const allDivs = document.querySelector('.panel-options')
.querySelectorAll('div');
const availableWidth = document.querySelector('.panel');
let panelAllDetails = document.querySelector('.panel-all').getBoundingClientRect()
let marginForSafety = 20;
let currentWidth = panelAllDetails.x + panelAllDetails.width + marginForSafety;
let windowWidth = window.innerWidth;
let cantAddMore = false;
for (let div of allDivs) {
let divWidth = parseFloat(div.getAttribute('data-width'),10);
let widthAfterAdding = currentWidth + divWidth;
if (widthAfterAdding < windowWidth) {
div.style.display = (cantAddMore) ? 'none' : 'flex';
currentWidth += divWidth;
} else {
div.style.display = 'none';
cantAddMore = true;
}
}
}
</script>
</html>