-
Notifications
You must be signed in to change notification settings - Fork 0
/
new.js
303 lines (289 loc) · 9.64 KB
/
new.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
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
let data=[
{
image:"https://www.sephora.com/productimages/sku/s2589612-main-zoom.jpg?imwidth=270",
name:"only at sephora",
detail:"ONE/SIZE by Patrick Starrr",
info:"Mascara",
price:"34.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2593861-main-zoom.jpg?imwidth=270",
name:"Sephora Favorites",
detail:"Luxe Vibes Luxury Beauty",
info:"Sampler Set",
price:"35.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2586741-main-zoom.jpg?imwidth=270",
name:"PAT McGRATH LABS",
detail:"Skin Fetish: Divine Blush Duo",
info:"Hourglasss",
price:"324.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2594810-main-zoom.jpg?imwidth=270",
name:"Hourglasss",
detail:"Ambient Soft Glow Foundation",
info:"Mascara",
price:"25.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2497204-main-zoom.jpg?pb=2020-03-sephora-value-2020&imwidth=270",
name:"SEPHORA COLLECTION.",
detail:"Bio-Radiant Gel- Powder Highlighter.",
info:"Total Coverage Angled Sponge-",
price:"87.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2497220-main-zoom.jpg?pb=2020-03-sephora-value-2020&imwidth=270",
name:"SEPHORA COLLECTION",
detail:"Signature Scent Duo",
info:"Total Coverage Blending",
price:"76.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2546505-main-zoom.jpg?imwidth=270",
name:"Urban Decay",
detail:"Vice Lip Bond Glossy Liquid",
info:"Lipstick",
price:"23.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2546497-main-zoom.jpg?pb=2020-03-sephora-value-2020&imwidth=270",
name:"Farmacy",
detail:"Peaches 'N Clean Makeup",
info:"Removing Cleansing Balm",
price:"98.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2589653-main-zoom.jpg?imwidth=270",
name:"MAKEUP BY MARIO",
detail:"SoftSculpt@ Transforming Skin",
info:"Mascara",
price:"26.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2588770-main-zoom.jpg?pb=clean-planet-positive-badge-2021&imwidth=270",
name:"Givenchy",
detail:"Pink Collection Prisme Libre",
info:"Highlighter",
price:"27.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2588515-main-zoom.jpg?imwidth=270",
name:"OLEHENRIKSEN",
detail:"Banana Bright+ Vitamin C Eye",
info:"Creme",
price:"10.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2577443-main-zoom.jpg?imwidth=270",
name:"Too Faced",
detail:"Better Than Chocolate",
info:"Eyeshadow Palette",
price:"28.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2592012-main-zoom.jpg?imwidth=320",
name:"WASO",
detail:"YUZU-C Eye Awakening Essence",
info:"Mascara",
price:"25.10"
},
{
image:"https://www.sephora.com/productimages/sku/s2591147-main-zoom.jpg?imwidth=270",
name:"SEPHORA COLLECTION",
detail:"KOSHIRICE Acne Calming Spot",
info:"Facial Razor Set",
price:"25.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2593309-main-zoom.jpg?pb=2020-03-sephora-clean-2019&imwidth=270",
name:"PAT McGRATH LABS",
detail:"Skin Fetish: Divine Blush Duo",
info:"Facial Razor Set",
price:"97.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2592012-main-zoom.jpg?imwidth=270",
name:"Natasha Denona",
detail:"Firmly Yours Dry Body Oil with Peptides",
info:"Mini Bronze Eyeshadow Palette",
price:"98.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2540201-main-zoom.jpg?imwidth=270",
name:"Benefit Cosmetics.",
detail:"BANGin' Deal Volumizing.",
info:"Mascara Value Set",
price:"29.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2600856-main-zoom.jpg?imwidth=270",
name:"Too Faced",
detail:"Chocolate Soleil Natural",
info:"Bronzer",
price:"21.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2546463-main-zoom.jpg?pb=2020-03-sephora-value-2020&imwidth=270",
name:"WASO",
detail:"YUZU-C Eye Awakening Essence",
info:"MascCremeara",
price:"05.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2588960-main-zoom.jpg?imwidth=270",
name:"WASO",
detail:"KOSHIRICE Acne Calming Spot",
info:"Masfhufha",
price:"25.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2595007-main-zoom.jpg?imwidth=270",
name:"PAT McGRATH LABS",
detail:"Skin Fetish: Divine Blush Duo",
info:"Lipstick",
price:"75.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2554418-main-zoom.jpg?pb=clean-planet-positive-badge-2021&imwidth=270",
name:"OLEHENRIKSEN",
detail:"Firmly Yours Dry Body Oil with Peptides",
info:"Super",
price:"25.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2591139-main-zoom.jpg?imwidth=270",
name:"HAUS LABS BY LAD.",
detail:"Bio-Radiant Gel- Powder Highlighter.",
info:"Eye Shdow",
price:"25.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2593739-main-zoom.jpg?pb=clean-planet-positive-badge-2021&imwidth=270",
name:"Moroccanoil",
detail:"Signature Scent Duo",
info:"CREAme",
price:"23.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2593739-main-zoom.jpg?pb=clean-planet-positive-badge-2021&imwidth=270",
name:"HAUS LABS BY LAD..",
detail:"Power Sculpt Velvet Bronzer with ",
info:"Masccomebackara",
price:"13.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2587665-main-zoom.jpg?imwidth=270",
name:"tarte",
detail:"Maracuja Juicy Glow Highlighting Stick",
info:"Juicy",
price:"22.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2563096-main-zoom.jpg?imwidth=270",
name:"MAKEUP BY MARIO",
detail:"SoftSculpt@ Transforming Skin",
info:"Mario",
price:"92.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2594703-main-zoom.jpg?imwidth=270",
name:"WASO",
detail:"SHIKULIME Gel-to-Oil Cleanser",
info:"Cleanser",
price:"67.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2558690-main-zoom.jpg?pb=clean-planet-positive-badge-2021&imwidth=270",
name:"Summer Fridays.",
detail:"ShadeDrops Broad Spectrum SPF 30",
info:"SPF",
price:"28.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2587087-main-zoom.jpg?imwidth=270",
name:"amika",
detail:"Hydro Rush Intense Moisture Conditione..",
info:"Hydro",
price:"35.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2589760-main-zoom.jpg?pb=2020-03-sephora-clean-2019&imwidth=270",
name:"WASO",
detail:"YUZU-C Eye Awakening Essence",
info:"Essence",
price:"25.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2583250-main-zoom.jpg?imwidth=270",
name:"WASO",
detail:"KOSHIRICE Acne Calming Spot",
info:"Spot",
price:"24.40"
},
{
image:"https://www.sephora.com/productimages/sku/s2567824-main-zoom.jpg?imwidth=270",
name:"PAT McGRATH LABS",
detail:"Skin Fetish: Divine Blush Duo",
info:"Blusher",
price:"97.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2590370-main-zoom.jpg?imwidth=270",
name:"OLEHENRIKSEN",
detail:"Firmly Yours Dry Body Oil with Peptides",
info:"Oil",
price:"46.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2578037-main-zoom.jpg?imwidth=320",
name:"HAUS LABS BY LAD.",
detail:"Bio-Radiant Gel- Powder Highlighter.",
info:"Radient",
price:"22.00"
},
{
image:"https://www.sephora.com/productimages/sku/s2601243-main-zoom.jpg?imwidth=270",
name:"Moroccanoil",
detail:"Signature Scent Duo",
info:"Scent",
price:"35.00"
},
]
let addArr2=JSON.parse(localStorage.getItem("cartData2")) || [];
data.forEach(function(elem,index){
let box=document.createElement("div");
let image=document.createElement("img");
image.setAttribute("src",elem.image);
let p1=document.createElement("p");
p1.innerText=elem.name;
let p2=document.createElement("p");
p2.innerText=elem.detail;
let p3=document.createElement("p");
p3.innerText=elem.info
let p4=document.createElement("p");
p4.innerText=elem.price;
let btn=document.createElement("button");
btn.innerText="Add to Cart";
btn.addEventListener("click",function(){
addHere2(elem);
})
box.append(image,p1,p2,p3,p4,btn);
document.querySelector("#main").append(box);
})
function addHere2(elem){
let image=elem.image;
let name=elem.name;
let info=elem.info;
let price=elem.price
let addObj2={
image:image,
name:name,
info:info,
price:price,
}
addArr2.push(addObj2);
localStorage.setItem("cartData2",JSON.stringify(addArr2));
}