-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
196 lines (139 loc) · 5.1 KB
/
index.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
var img = ["https://n.nordstrommedia.com/id/a2095c23-e54d-44c6-885b-b56c16aa6f75.jpeg?h=200&w=1606","https://n.nordstrommedia.com/id/1793a6ae-12a6-46d9-9c2e-23aa9ff1a0e5.jpeg?h=200&w=1608"]
function changeImg(){
let i=0;
setInterval(function(){
document.getElementById("img").src=img[i];
if(i<img.length-1){
i++;
}
else{
i=0;
}
},3000);
}
changeImg();
var img1 = [
{
img:"https://n.nordstrommedia.com/id/684ef2e6-362c-49da-9a87-6b2421c00afc.jpeg?h=720&w=1608",
h1 :"Love by Design & More",
p:"A go-to dress for all those summer RSVPs? Voilà",
pu:"Love by Design One-Shoulder Dress",
pu2:"All Cocktail & Party Dresses"
} ,
{
img :"https://n.nordstrommedia.com/id/8881ce44-5e3b-40e3-8ff7-122fab6adff7.jpeg?h=720&w=1608",
h1 : "Classic Styles from Classic Brands",
p:"Here's how to dress for warmer weather.",
pu:"Ray-Ban MadeWell"
} ,
{
img : "https://n.nordstrommedia.com/id/8c581ec3-f7eb-49ac-9ba3-436c2f419ae4.jpeg?h=720&w=1608",
h1:"Ends June 18 at 11:59PM PT",
p:"Selected styles for women, men and kids. Online only. Not combinable with any other offers.",
pu:"Nike Sell",
},
];
const image = document.getElementById("image");
const h1 = document.getElementById("h1");
const p = document.getElementById("para");
const pu = document.getElementById("pu");
const pu2 = document.getElementById("pu2");
function changeImg1(){
let i=0;
var line =1;
setInterval(()=> {
image.src=img1[i].img;
h1.textContent=img1[i].h1;
p.textContent=img1[i].p;
pu.textContent=img1[i].pu;
pu2.textContent=img1[i].pu2;
if(i<img1.length-1){
i++;
}
else{
i=0;
}
},5000);
}
changeImg1();
var whiteDressObj =[
{
img : "https://n.nordstrommedia.com/id/8215da80-d860-4343-a3d0-307babe46273.jpeg?h=369&w=240",
title :"Love By Design",
price : "$54.99 (43% off)",
cutPrice : "$90.00",
// a:"5",
},
{
img : "https://n.nordstrommedia.com/id/sr3/675c4b4e-8cc0-4778-9630-a1ed689cafc3.jpeg?q=45&fit=fill&fm=jpg&dpr=2&h=408&w=266",
title :"Love By Design",
price : "$54.99 (43% off)",
cutPrice : "$90.00",
},
{
img : "https://n.nordstrommedia.com/id/sr3/c929dedc-8816-471d-b828-28dcc8c8cd72.jpeg?q=45&fit=fill&fm=jpg&dpr=2&h=408&w=266",
title :"NSR",
price : "$54.99 (42% off)",
cutPrice : "$95.00",
},
{
img : "https://n.nordstrommedia.com/id/sr3/8d0e906c-ced2-4c89-94ea-137a635e3a7c.jpeg?q=45&fit=fill&fm=jpg&dpr=2&h=408&w=266",
title :"Area Stars",
price : "$69.97 (60% off)",
cutPrice : "$175.00",
},
{
img : "https://n.nordstrommedia.com/id/sr3/9028d4e8-97f8-496f-ad86-a67b733e38d5.jpeg?q=45&fit=fill&fm=jpg&dpr=2&h=408&w=266",
title :"Love By Design",
price : "$44.97 (51% off)",
cutPrice : "$92.00",
},
{
img : "https://n.nordstrommedia.com/id/sr3/c500fcb0-a160-42a0-8b35-6f7ada10db0d.jpeg?q=45&fit=fill&fm=jpg&dpr=2&h=408&w=266",
title :"Love By Design",
price : "$49.97 (47% off)",
cutPrice : "$96.00",
},
];
localStorage.setItem("whiteProducts",JSON.stringify(whiteDressObj));
var whiteProductsObj = JSON.parse(localStorage.getItem("whiteProducts"))
// console.log(whiteProducwhiteDressObjtsObj);
displayData(whiteDressObj)
function displayData(data){
document.getElementById("eleventhDiv").innerText="";
data.forEach(function(el){
console.log(el)
let div = document.createElement("div")
let picture = document.createElement("picture")
let detailsProducts = document.createElement("div")
let img = document.createElement("img")
img.src = el.img;
img.style.width="200px";
let title = document.createElement("p")
title.innerText=el.title;
title.style.fontSize="13px";
title.style.marginLeft="20px";
title.style.color="#393939";
let price = document.createElement("p")
price.innerText=el.price;
price.style.fontSize="13px";
price.style.marginLeft="20px";
price.style.fontWeight="700";
let cutPrice = document.createElement("strike")
cutPrice.innerText=el.cutPrice;
cutPrice.style.fontSize="13px";
cutPrice.style.marginLeft="20px";
cutPrice.style.color="#393939";
let star = document.createElement("img")
star.src=el.star;
let usersBuy = document.createElement("p")
usersBuy.innerText=el.usersBuy;
// let a = document.createElement("a")
// a.innerText=el.a;
picture.append(img)
detailsProducts.append(title,price,cutPrice)
div.append(picture,detailsProducts)
var body = document.getElementById("eleventhDiv")
body.append(div)
})
}