forked from arghadipmanna101/Flipkart_Clone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
topdeals.js
62 lines (56 loc) · 1.4 KB
/
topdeals.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
const topdeals = [
{
"name": "Top deal",
"description": "Top deal description",
"imageUrl": "topDeal1.webp"
},
{
"name": "Top deal",
"description": "Top deal description",
"imageUrl": "topDeal2.webp"
},
{
"name": "Top deal",
"description": "Top deal description",
"imageUrl": "topDeal3.webp"
},
{
"name": "Top deal",
"description": "Top deal description",
"imageUrl": "topDeal4.webp"
},
{
"name": "Top deal",
"description": "Top deal description",
"imageUrl": "topDeal5.webp"
},
{
"name": "Top deal",
"description": "Top deal description",
"imageUrl": "topDeal6.webp"
},
{
"name": "Top deal",
"description": "Top deal description",
"imageUrl": "topDeal7.webp"
},
{
"name": "Top deal",
"description": "Top deal description",
"imageUrl": "topDeal8.webp"
}
]
function addTopdeals() {
const topdealsWrapper = $(".swiper-wrapper");
topdeals.map((t) => {
const slide = $("<div>").addClass("swiper-slide").html(`
<img src="./images/${t.imageUrl}" alt="">
<h4>${t.name}</h4>
<p>${t.description.substring(0, 50)}</p>
`);
topdealsWrapper.append(slide);
});
}
$(document).ready(function() {
addTopdeals();
});