-
Notifications
You must be signed in to change notification settings - Fork 1
/
project-details.html
171 lines (168 loc) · 5.31 KB
/
project-details.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
<!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 id="titletop"></title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<style>
#contentsDiv{
display: flex;
justify-content: center;
align-items: center;
}
#imgsDiv,#detailsDiv{
height: 500px;
}
#bigimg{
width: 550px;
min-height: 300px;
max-height: 300px;
}
.smimgs{
height: 80px;
width: 100px;
border: 1px solid gray;
}
.breadcrumb{
background-color: transparent;
border: 1px lightgray solid;
font-size: 12px;
color:darkgray;
margin-top: 10px;
}
.breadcrumb-item,.breadcrumb-item a{
color: darkslategray !important;
font-weight: bold;
}
.active{
color:black;
font-weight: normal;
}
#detailsDiv{
width:300px;
}
#title,#description{
word-wrap: break-word;
font-weight: bold;
}
#smlimgsDiv{
display: flex;
width: 550px;
margin-top: 10px;
flex-wrap: wrap;
margin-left: 6px;
}
#points{
list-style: none;;
}
.container{
background:center/cover no-repeat url('interface.png')
}
body{
background:center/cover no-repeat url('interface.png')
}
@media (max-width:800px){
#contentsDiv{
flex-direction: column;
}
#detailsDiv{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#imgsDiv{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#smlimgsDiv{
display: flex;
justify-content: center;
align-items: center;
}
}
</style>
</head>
<body>
<div class="container">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="projects.html">Home</a></li>
<li class="breadcrumb-item"><a id="catlink"href="#"></a></li>
<li id="titleli" class="breadcrumb-item active" aria-current="page"></li>
</ol>
</nav>
<div id="contentsDiv">
<div id="imgsDiv" class="mr-5">
<div id="bigimgDiv">
<img id="bigimg">
</div>
<div id="smlimgsDiv">
</div>
</div>
<div id="detailsDiv">
<h4 id="title"></h4>
<ul id="points">
</ul>
<p id="description"></p>
<h3 id="price"></h3>
<!-- <div id="btnDiv" class="mt-3">
<button class="btn btn-lg btn-warning mr-2">Add to Cart</button>
<button class="btn btn-lg btn-primary mr-2">Buy Now</button>
</div> -->
</div>
</div>
</div>
<script>
let product=null;
window.onload=function(){
product=localStorage.Product;
if(product){
product=JSON.parse(product);
LoadProduct();
}
}
function LoadProduct(){
document.getElementById('titleli').innerHTML=product.ProductTitle;
document.getElementById('titletop').innerHTML=product.ProductTitle;
document.getElementById('catlink').innerHTML=product.Category;
document.getElementById('bigimg').src=product.LinksOfImagesArray[0];
document.getElementById('title').innerHTML=product.ProductTitle
document.getElementById('description').innerHTML="DESCRIPTION:\n "+product.Description;
document.getElementById('price').innerHTML="Created By:\n "+product.Price;
// if(product.Stock<1)document.getElementById('btnDiv').innerHTML='<h3>class="text-warning">Out Of Stock</h3>'
GenLi();
GenImgs();
}
function GenLi(){
product.Points.forEach(html=>{
if(html.length>1){
var li=document.createElement('li');
li.innerHTML=html;
document.getElementById('points').append(li);
}
})
}
function GenImgs(){
let i=1;
let html='';
product.LinksOfImagesArray.forEach(imglink=>{
let img=document.createElement('img');
img.src=imglink;
img.classList.add("smimgs","mr-2","mb-2");
img.id='im'+(i++);
img.addEventListener('click',ChangeBigImg);
document.getElementById('smlimgsDiv').append(img);
})
}
function ChangeBigImg(event){
let elem=document.getElementById(event.target.id);
document.getElementById('bigimg').src=elem.src;
}
</script>
</body>
</html>