-
Notifications
You must be signed in to change notification settings - Fork 4
/
wishlist.html
174 lines (130 loc) · 3.87 KB
/
wishlist.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
<!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>wishlist</title>
<link rel="stylesheet" href="./cart.css">
<style>
#navbar {
height: 60px;
width: 100%;
background-color: black;
text-align: center;
padding-top: 30px;
}
h3 {
font-size: 12px;
color: white;
font-family: Manrope,sans-serif;
}
p{
font-size: 25px;
font-weight:8;
font-family: Manrope,sans-serif;
}
#navbar~div{
text-align: center;
padding-top: 100px;
}
button{
border: 1px solid orangered;
height:45px;
width: 200px;
color:orangered;
}
.item>div>img
{
width:100%;
height:100% }
#dis
{
margin: auto;
width: 100%;
justify-content: space-around;
}
</style>
</head>
<body id="bodyT">
<div id="container">
<div id="navbar">
<h3>MY WISHLIST</h3>
</div>
<div id="dis">
<img src=" https://www.pepperfry.com/images/svg/empty-wishlist.svg" alt="">
<p>You Haven't Added Any Item To Your wishlist</p>
<a href="index.html"><button>START WISHING 😀</button></a>
</div>
</div>
</body>
</html>
<script>
if(screen.width==1280)
{
let x=document.getElementById("bodyT");
x.style="zoom: 0.69;,-moz-transform: scale(0.69);"
}
let dataWish = JSON.parse(localStorage.getItem("wishData"));
displaywish();
function displaywish()
{
if(dataWish.length>0)
{
document.getElementById("dis").innerHTML = "";
let div1 = document.getElementById("dis");
let discount = Number(dataWish[0].discount);
dataWish.forEach(function (el, i) {
var count = dataWish[0].quantity;
console.log(el);
let item = document.createElement("div");
item.setAttribute("class", "item");
//--------------Image-----------------------//
let div1A = document.createElement("div");
let img = document.createElement("img");
img.classList = "pics";
img.src = el.image1;
div1A.append(img);
//--------------------Description-------------------//
let div1B = document.createElement("div");
let div1B1 = document.createElement("div");
div1B1.innerText = `${el.name} - ${el.brand}`;
let div1B2 = document.createElement("div");
div1B2.innerText = "12 Month's Warranty, 100% Genuine";
div1B2.style.color = "#f16521";
let div1B3 = document.createElement("div");
// div1B3.innerText = `Delivery by 8th April.`;
div1B3.style.color = "darkgrey";
div1B.append(div1B1, div1B2, div1B3);
//-------------------prices-----------------------//
let div1C = document.createElement("div");
let div1C1 = document.createElement("div");
div1C1.style.cursor = "pointer";
let div1C3 = document.createElement("div");
div1C3.style.cursor = "pointer";
let discount_price = document.createElement("div");
discount_price.innerText = `Price ₹ ${Number(el.discount_price)}`;
discount_price.style.marginTop = "25%";
discount_price.style.color = "#f16521";
discount_price.style.fontWeight = 700;
let divUP = document.createElement("div");
divUP.classList = "quan";
divUP.append(div1C1,div1C3);
div1C.append(divUP, discount_price);
//...................
let div1D = document.createElement("button");
div1D.innerText = "REMOVE";
div1D.style.margin = "auto";
div1D.addEventListener("click", function (i) {
let existData = JSON.parse(localStorage.getItem("wishData"))
item.remove(i);
existData.splice(i,1)
window.location.reload();
localStorage.setItem("wishData", JSON.stringify(existData));
});
item.append(div1A, div1B, div1C,div1D);
div1.append(item);
});
}
}
</script>