-
Notifications
You must be signed in to change notification settings - Fork 4
/
p0.html
292 lines (243 loc) · 9.5 KB
/
p0.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
<!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>Document</title>
</head>
<link rel="stylesheet" href="commonstyles.css">
<link rel="stylesheet" href="./style/navbar.css">
<body>
<div id="navbar-top">
</div>
<div id="banner">
<img src="https://img.gkbcdn.com/s3/bn/2206/1500x125-62a9512c2b40c91d488eee03.jpg">
</div>
<div id="mainalpha">
<div id="prodimg">
</div>
<div id="details">
</div>
</div>
<div id="shareto">
<p>Share to :  </p>
<a href="https://twitter.com/intent/tweet?text=Netac%20N600S%201TB%20SSD%202.5%20Inch%20Solid%20State%20Drive%20Blue&url=https%3A%2F%2Fwww.geekbuying.com%2Fitem%2FNetac-N600S-1TB-SSD-2-5-Inch-Solid-State-Drive-Blue-409006-409006.html%23.YqwjoKV-DP4.twitter&related=">
<img id="twitter" src="https://cdn-icons.flaticon.com/png/128/2504/premium/2504839.png?token=exp=1655449450~hmac=94cc405593928cc1b86920cc2d2eb492"/>
</a>
</div>
<div id="extra">
<div class="extrap"><a href="#description"><h3 >Description</h3></a></div>
<div class="extrap"><a href="#reviews"><h3>Reviews</h3></a></div>
<div class="extrap"> <a href="#QnA"><h3>QnA</h3></a></div>
</div>
<h2 class="highlights">Highlights</h2>
<div id="description"></div>
<h2 class="highlights">Customer Reviews</h2>
<div id="reviews">
User 1:   Lorem ipsum dolor, sit amet consectetur adipisicing elit. Rerum placeat magnam maxime vero perspiciatis quod, fuga cum vel dolores, ex ipsa! Adipisci quis cumque impedit, enim necessitatibus reiciendis. Maiores, autem.<br><br><hr>
User 2:   Lorem ipsum dolor, sit amet consectetur adipisicing elit. Rerum placeat magnam maxime vero perspiciatis quod, fuga cum vel dolores, ex ipsa! Adipisci quis cumque impedit, enim necessitatibus reiciendis. Maiores, autem.<br><br><hr>
User 3:   Lorem ipsum dolor, sit amet consectetur adipisicing elit. Rerum placeat magnam maxime vero perspiciatis quod, fuga cum vel dolores, ex ipsa! Adipisci quis cumque impedit, enim necessitatibus reiciendis. Maiores, autem.<br>
</div>
<h2 class="highlights">Questions & Answers</h2>
<div id="QnA">
<p>Temporarily no Discussion</p>
</div>
</body>
</html>
<script type="module">
import {navbar,footer} from "./navbar/navbar.js"
document.getElementById("navbar-top").innerHTML = navbar()
let images=[
"https://img203.yun300.cn/repository/image/fe39c25e-28ab-4eff-bf89-8e9e2d164df9.jpg?tenantId=263312&viewType=1",
'https://img203.yun300.cn/repository/image/411173d2-a16e-4c62-ac2b-47d22a0df44f.jpg?tenantId=263312&viewType=1',
'https://img203.yun300.cn/repository/image/e5f6789d-d2ef-4842-88f6-e02751c77d2f.jpg?tenantId=263312&viewType=1'
]
let items=JSON.parse(localStorage.getItem("addcart"))||[];
let obj={
image:'https://img.gkbcdn.com/p/2018-11-22/netac-n600s-1tb-ssd-2-5-inch-solid-state-drive-blue-1571991121689._w280_p1_.jpg',
fullname:'Netac N600S 1TB SSD 2.5 Inch Solid State Drive SATA3 Interface Read Speed 500MB/s - Blue',
detail:"Netac N600S 1TB SSD 2.5 Inch Solid State Drive",
brand:"Netac",
original:'11272',
beforeprice:"13044",
discpercent:"14",
count:1,
rating:'4.86 27 Reviews ',
descriptionimg:'https://img.gkbcdn.com/s3/d/201811/f71e3e79-691f-4234-96d0-d0b506bfe74b.jpg',
description:`
SATA3 6Gb/s transmission rate, supporting SATA2 / 1 downward.
Support LDPC intelligent error correction algorithm to ensure data security.
Adopt SLC virtual cache technology to effectively improve data transmission speed.
Support wear equalization technology, balance the number of flash wipe and extend the service life.
Support TRIM instruction, SMART and Dev-Sleep mode.
No sensitive machine parts, effective vibration resistance, quiet operation, and low consumption.`
}
// document.createElement('')
let product_cont=document.querySelector('#details');
let title=document.createElement('h4')
title.innerText=obj.fullname;
let div1=document.createElement('div');
div1.id='rating';
let star= document.createElement('img')
star.src='./download.png';
star.className='icons'
let rating= document.createElement('p')
rating.innerText=`${obj.rating} `;
let brand = document.createElement('p');
brand.innerText= `Brand: ${obj.brand}`
div1.append(star,rating,brand)
let div2=document.createElement("div")
div2.id='flashdeal'
let tbolt= document.createElement('img')
tbolt.className='icons'
tbolt.src="./thunderbolt.jpg"
let flashdeal=document.createElement('h4')
flashdeal.id="fdtext"
flashdeal.innerText=`Flashdeal`
let div21=document.createElement('div');
div21.id="timers"
let timer1= document.createElement('h4');
let timer2= document.createElement('h4')
timer1.innerText="Ends in 1 day 10 : 10 :";
timer2.innerText=" 0";
//TO display timer
function timer(){
let i=59
let j=10;
let id=setInterval(function(){
// console.log(i)
if(j==0){
// h.innerText="0"
clearInterval(id)
}
timer2.innerText=` ${i} `;
i--;
if(i==0){
j--;
timer1.innerText="Ends in 1 day 10 : "+j+" : ";
i=60;
}
},1000)
}
timer();
div21.append(timer1,timer2)
div2.append(tbolt,flashdeal,div21)
let price=document.createElement('div');
price.id="price"
price.innerHTML=`<h2 id="actprice">₹${obj.original}</h2>
<p id="origprice"><s>₹${obj.beforeprice}</s></p>
<p id="discpercent">${obj.discpercent}% OFF</p>
`
//-------------------------------------------------------------------------------//
let counter=document.createElement('div');
counter.id="counter"
let count=obj.count;
let qty=document.createElement('div');
qty.innerHTML=`QTY : `
let countdisplay=document.createElement('div');
countdisplay.id="count"
countdisplay.innerText=count;
let incb=document.createElement("div")
incb.id="countplus"
incb.innerText="+"
let decb=document.createElement("div")
decb.innerText="-"
decb.id="countminus"
decb.addEventListener("click", decFun);
function decFun() {
if(count==1)
count=1;
else
count--;
countdisplay.innerText = count;
obj.count=count;
// localStorage.setItem("counterValue", count);
}
incb.addEventListener("click", incFun);
function incFun() {
count++;
countdisplay.innerText = count;
obj.count=count;
// localStorage.setItem("counterValue", count);
}
counter.append(qty,decb,countdisplay,incb)
//--------------------------------------------------------------------------------------//
let shipping=document.createElement("p")
shipping.id="shipping"
shipping.innerText="Shipping within 3-5 days, Delivery within 10 days"
let buycart=document.createElement("div")
buycart.id="buycart"
let bt1=document.createElement("button")
bt1.id="addcart"
let bt2=document.createElement('button')
bt2.id="buynow"
bt1.innerText="Add to Cart"
bt2.innerText="Buy Now"
bt1.addEventListener("click",buy)
buycart.append(bt1,bt2)
let payment=document.createElement("div")
payment.id="payment"
let pay=document.createElement("p")
pay.innerText="Payment: "
pay.style.marginTop="3%"
let paypal=document.createElement('img')
paypal.src="./paypal.png"
paypal.id="iconpay"
payment.append(pay,paypal)
product_cont.append(title,div1,div2,price,counter,shipping,buycart,payment)
//to display slideshow
let i=0;
let container=document.querySelector("#prodimg");
function storedata(){
var fimg=document.createElement("img")
fimg.src=images[0]
container.append(fimg)
i=1
setInterval(function(){
if(i===images.length){
i=0;
}
container.innerHTML=null;
let currimage=images[i];
// console.log("i",i)
let img=document.createElement("img")
img.src=currimage;
container.append(img)
i++;
},2000)
}
storedata()
//-------------------------------------------------------------------------------//
let description=document.getElementById("description")
let desc1=document.createElement("p")
desc1.innerText=obj.description;
let descimg=document.createElement("img")
descimg.id="specifications_img"
descimg.src=obj.descriptionimg;
description.append(desc1,descimg)
//to add in "addcart"
function buy(){
if(items.length==0||items[items.length-1].detail!==obj.detail)
items.push(obj)
else
items[items.length-1]=obj;
localStorage.setItem("addcart",JSON.stringify(items))
//changes cart items number in real time
document.getElementById("noofpro").innerText=items.length;
alert("Product added successfully")
}
//to redirect to cart page
bt2.addEventListener("click",()=>{
window.location.href="cart.html"
})
//to check and display name in navbar
var user = JSON.parse(localStorage.getItem("user"))
if(user.name ==null){
document.getElementById("signin").innerText = "signin"
}
else{
document.getElementById("signin").innerText = user.name
}
document.getElementById("noofpro").innerText = items.length
</script>