-
Notifications
You must be signed in to change notification settings - Fork 1
/
productDetail.html
71 lines (62 loc) · 2.42 KB
/
productDetail.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
<!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" />
<link rel="stylesheet" href="productDetail.css" />
<link rel="stylesheet" href="navbar.css" />
<link rel="stylesheet" href="footer.css" />
<link rel="icon" href="https://www.linkpicture.com/q/00000.png">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
<title>Document</title>
</head>
<body>
<div id="navbar"></div>
<div class="container">
<div class="container_left">
<img src="https://images.bewakoof.com/t640/men-black-kyojin-os-printed-t-shirt-542577-1672842691-1.jpg" alt="">
</div>
<div class="container_right">
<p class="project" id="brand">Clothing Keeda</p>
<p id="title">Title</p>
<p id="rating">Rating</p>
<p class="project" id="price">Price</p>
<p id="saving"></p>
<p id="mrp"></p>
<button id="plus">Plus Size</button>
<hr />
<p id="des">TriBe members get an extra discount of ₹70 and FREE shipping.</p>
<hr>
<div id="flex">
<button class="addTocart" id="addto">Add To Cart</button>
<button class="addTocart">Add To Wishlist</button>
</div>
</div>
</div>
<div id="footer"></div>
</body>
</html>
<script>
let cart=JSON.parse(localStorage.getItem("cartProduct"))||[];
let obj=JSON.parse(localStorage.getItem("detail"))
document.querySelector("#title").innerText=obj.Title;
document.querySelector("#rating").innerText="Rating: "+ obj.Rating;
document.querySelector("#price").innerText="Price: ₹" + obj.Mrp ;
document.querySelector("#saving").innerText="SAVINGS ₹"+(obj.Price-obj.Mrp);
document.querySelector("#mrp").innerText="MRP: ₹" + obj.Price;
document.querySelector("#brand").innerText=obj.Brand;
document.querySelector("img").src=obj.Img_ulr;
let add=document.querySelector("#addto")
add.addEventListener("click",addtocart)
function addtocart(){
if(cart.includes(obj)){
alert("Already product in cart")
}else{
cart.push(obj);
localStorage.setItem("cartProduct",JSON.stringify(cart))
alert("Product added")
}
}
</script>
<script src="./index.js" type="module"></script>