-
Notifications
You must be signed in to change notification settings - Fork 1
/
patient-photo_gallery.html
166 lines (144 loc) · 5.21 KB
/
patient-photo_gallery.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Memory Lane</title>
<style>
body {
font-family: 'Jost', sans-serif;
}
h1 {
text-align: center;
margin-bottom: 20px;
}
#gallery {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 15px;
padding: 10px;
}
.image-container {
max-width: 400px;
max-height: 400px;
overflow: hidden;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
transition: transform 0.2s;
}
.image-container img {
width: 100%;
height: auto;
object-fit: cover;
cursor: pointer;
}
.image-container:hover {
transform: scale(1.05);
}
/* Modal Styles */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
justify-content: center;
align-items: center;
}
.modal img {
max-width: 90%;
max-height: 90%;
border-radius: 8px;
}
.modal:target {
display: flex;
}
.close {
position: absolute;
top: 10px;
right: 20px;
color: white;
font-size: 30px;
text-decoration: none;
font-weight: bold;
}
</style>
<!--CSS-->
<link rel="stylesheet" href="./dist/output.css">
<!--ICONS-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.min.css">
<!--Fonts-->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Jost:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<script type="module" src="./js/sign-up.js" defer></script>
</head>
<body>
<header class="sticky top-0 h-[90px] shadow-xl z-30 bg-white">
<div class="container mx-auto flex justify-between h-full items-center">
<a href="#">
<img src="./assets/logo.jpeg" alt="" class="w-[200px]">
</a>
<nav>
<div class="cursor-pointer lg:hidden" id="nav_trigger_btn">
<i class="ri-menu-4-line text-4xl text-primary"></i>
</div>
<ul class="fixed w-full h-0 p-0 bg-white overflow-hidden border-t top-[90px] left-0 right-0 flex flex-col gap-4 lg:relative lg:flex-row lg:p-0 lg:top-0 lg:border-none lg:h-full transition-all duration-300" id="nav_menu">
<li class="p-2"><a href="./patient-dashboard.html">Dashboard</a></li>
<li class="p-2"><a href="./index.html">Home</a></li>
<li class="p-2"><a href="./index.html#about">About</a></li>
<li class="p-2"><a href="./index.html#contact">Contact Us</a></li>
<div id="user-auth-section">
<button class="btn-accent w-[120px] h-[50px] lg:p-0 p-2 rounded-lg">
<a href="./sign-up.html" class="text-white hover:text-black" id="auth-btn">Sign In</a>
</button>
</div>
</ul>
</nav>
</div>
</header>
<section class="steps mt-[30px] xl:mt-[30px] relative z-20 mb-10">
<div class="container mx-auto">
<h1 class="h2">Photo Gallery</h1>
<div id="gallery"></div>
</div>
</section>
<!-- Modal for full image view -->
<div id="modal" class="modal">
<a href="#" class="close">×</a>
<img id="modal-image" src="" alt="Full Image">
</div>
<script>
// Open or create an IndexedDB instance
const request = indexedDB.open('imageDB', 1);
request.onsuccess = function(event) {
const db = event.target.result;
const transaction = db.transaction('images', 'readonly');
const store = transaction.objectStore('images');
const getRequest = store.getAll();
getRequest.onsuccess = function() {
const imagesArray = getRequest.result;
const galleryDiv = document.getElementById('gallery');
const modal = document.getElementById('modal');
const modalImage = document.getElementById('modal-image');
imagesArray.forEach(imageObj => {
const imgContainer = document.createElement('div');
imgContainer.className = 'image-container';
const img = document.createElement('img');
img.src = imageObj.image;
imgContainer.appendChild(img);
galleryDiv.appendChild(imgContainer);
img.addEventListener('click', () => {
modalImage.src = img.src;
window.location.href = '#modal'; // Open modal
});
});
};
};
</script>
</body>
</html>