-
Notifications
You must be signed in to change notification settings - Fork 0
/
burGallery.html
317 lines (223 loc) · 12 KB
/
burGallery.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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Document -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- SEO -->
<meta name="robots" content="all, index, follow, noodp, noydir, noarchive">
<!-- Description -->
<meta name="description" content="A simple yet powerful, fully customizable, modern image gallery developed using javascript and css.">
<!-- Title -->
<title>burGallery. A modern JavaScipt/CSS image gallery.</title>
<!-- Base URL -->
<base href="">
<!-- Favicon -->
<link rel="icon" type="image/x-icon" href="img/ui/favicon.ico">
<!-- CSS: burGallery -->
<link rel="stylesheet" type="text/css" href="css/burGallery_min.css">
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/acbd2d4fd6.js" crossorigin="anonymous"></script>
<!-- JavaScript: burGallery -->
<script src="js/burGallery_min.js"></script>
<script>
/* Use custom events if there's a need to run any code after the class has built your gallery
--------------------------------- */
toggle_scroll_orientation = () => {
if (document.querySelector(".pagination").classList.contains("vertical")) {
document.querySelector(".pagination").classList.remove("vertical");
document.querySelector(".pagination_orientation_btn").innerHTML = "";
document.querySelector(".pagination_orientation_btn").classList.remove("active");
portfolio.containers.scroll.classList.remove("vertical");
for (let a = 1; a < portfolio.status.total_albums+1; a++) {
let album_num = a;
/*console.log(a);*/
let total_images = portfolio.containers.scroll.querySelector(`.album_${ album_num }`).querySelectorAll(".thb").length;
for (let i = 0; i < total_images; i++) {
portfolio.containers.scroll.querySelector(`.album_${ album_num }`).querySelectorAll(".thb")[i].classList.remove("vertical");
}
}
}
else {
document.querySelector(".pagination").classList.add("vertical");
document.querySelector(".pagination_orientation_btn").innerHTML = "";
document.querySelector(".pagination_orientation_btn").classList.add("active");
portfolio.containers.scroll.classList.add("vertical");
for (let a = 1; a < portfolio.status.total_albums+1; a++) {
let album_num = a;
let total_images = portfolio.containers.scroll.querySelector(`.album_${ album_num }`).querySelectorAll(".thb").length;
for (let i = 0; i < total_images; i++) {
portfolio.containers.scroll.querySelector(`.album_${ album_num }`).querySelectorAll(".thb")[i].classList.add("vertical");
}
}
}
}
menu_state = () => {
if (portfolio.containers.album_navigation.querySelector(".dropdown_content").classList.contains("active")) {
portfolio.containers.album_navigation.querySelector(".dropdown_content").classList.remove("active");
}
if (document.querySelector(".menu").classList.contains("active")) {
document.querySelector(".menu").classList.remove("active");
document.querySelector(".menu_close").innerHTML = "";
portfolio.containers.modal_content.style.marginTop = "40px";
}
else {
document.querySelector(".menu").classList.add("active");
document.querySelector(".menu_close").innerHTML = "";
portfolio.containers.modal_content.style.marginTop = "80px";
}
}
window_resize_adjustments = () => {
if (portfolio.containers.album_navigation.querySelector(".dropdown_content").classList.contains("active")) {
portfolio.containers.album_navigation.querySelector(".dropdown_content").classList.remove("active");
}
document.querySelector(".menu").classList.add("active");
document.querySelector(".menu_close").innerHTML = "";
portfolio.containers.modal_content.style.marginTop = "80px";
/*portfolio.containers.images.style.pointerEvents = "none";*/
}
window.onresize = window_resize_adjustments;
custom_event = () => {
menu_state();
/*portfolio.containers.images.addEventListener("click", () => {
menu_state();
});*/
portfolio.containers.title.addEventListener("click", () => {
portfolio.containers.album_navigation.querySelector(".dropdown_btn").click();
});
document.querySelector(".pagination_orientation_btn").addEventListener("click", () => {
toggle_scroll_orientation();
});
document.querySelector(".menu_close").addEventListener("click", () => {
menu_state();
});
/*document.querySelector(".pagination_bg_btn").addEventListener("click", () => {
toggle_scroll_orientation();
});*/
}
</script>
</head>
<body>
<noscript><div><h3>This website uses JavaScript.</h3><p>Your browser has JavaScript disabled or does not support it, so some content or features may not be functional or available to you at this time.</p></div></noscript>
<!-- Site Name -->
<h1>burGallery</h1>
<p>A modern JavaScipt/CSS image gallery.</p>
<!-- Sample Gallery div with the name "portfolio" -->
<div class="portfolio">
<!-- Gallery Title -->
<h2>Portfolio (demo gallery)</h2>
<!-- Gallery thumbnails/icons -->
<div class="grid"></div>
<!-- Preload thumbnail/icon active state (optional) -->
<!-- <div class="grid_thb_hvr_preload_img"></div> -->
<!-- Gallery modal -->
<div class="modal">
<!-- Slideshow Progress bar -->
<div class="progress">
<div class="progress_bar"><span>1%</span></div>
</div>
<!-- Modal content -->
<div class="modal_content">
<!-- Album Title -->
<div class="title">Gallery Title - Album Name</div>
<!-- Album navigation -->
<div class="album_navigation"><button class="dropdown_btn fas"></button></div>
<!-- Slideshow Main -->
<div class="slideshow">
<div class="menu">
<!-- Menu options -->
<div class="options">
<button class="pause_btn fas"></button> <!-- Toggle Play/Pause -->
<button class="caption_btn fas"></button> <!-- Toggle caption -->
<button class="appearance_btn fas"></button> <!-- Toggle appearance mode -->
<button class="fwindow_btn fas"></button> <!-- Toggle full window -->
<span class="counter">0/0</span> <!-- Counter -->
<button class="fscreen_btn fas"></button> <!-- Toggle full screen -->
<button class="download_btn fas"></button> <!-- Download image -->
<button class="pagination_orientation_btn fas"></button> <!-- Pagination orientation -->
<!-- <div class="album_navigation"><button class="dropdown_btn fas"></button></div> --> <!-- Album navigation -->
<button class="close_btn fas"></button> <!-- Gallery (and album) close -->
</div>
<div class="menu_close fas"></div>
</div>
<div class="images"></div> <!-- Gallery images -->
<p class="caption">Caption</p> <!-- Image caption -->
</div>
<!-- Gallery pagination first, last, next, previous, scroll -->
<div class="pagination">
<button class="first_btn fas"></button>
<button class="previous_btn fas"></button>
<div class="scroll"></div>
<button class="next_btn fas"></button>
<button class="last_btn fas"></button>
<!-- <div class="pagination_bg_btn" style="width: 100%; height: 100%; background-color: red;"></div> -->
</div>
</div>
</div>
</div>
<!-- Sample Gallery: /div: Portfolio -->
<!-- Gallery optional user settings -->
<script>
const portfolio_options = {
appearance_mode: false, // Dark/light mode (true/false)
caption: false, // Auto show/hide caption (true/false)
custom_event: true, // Callback function custom_event(), to trigger after gallery fully loads (true/false)
display: false, // Auto-display (true/false)
fscreen: false, // Full screen display (true/false): Triggered when a grid thb, or the toggle button, is selected. Cannot be triggered onload when using "display: true" as full screen requires user interaction.
fwindow: false, // Full window display (true/false)
loop: true, // When slideshow reaches last image, loop back to beginning. (true/false)
play: false, // Auto-play (true/false): To be used with auto-display
slideshow_speed: 2000, // Delay time between slides. Milliseconds: 1000 = 1 second
template: {
// IMAGES: Create a custom container for your images. The closing tag(s) go in their own object "images_wrapper_close", see below. The default is one div closing tag, so if you do not include a closing tag here, that's what it will default to, which may or may not be what you need: If your custom "images_wrapper_open" requires something different or more than just a single closing div (</div>) tag, don't forget to include a proper "images_wrapper_close" object below!
// "images_wrapper_open" returns just about any value for use in your custom markup except for current image. Or leave blank, as it is here, if no values are used.
images_wrapper_open: (element, album_num, album_title, image_folder, total_images) => {
return "<div class='bb-container'>" +
"<div class='bb-content bb-display-container bb-card'>";
},
// Build index of images/slides for each respective album
// "images_wrapper_content" returns just about any value for use in your custom markup, including current image
images_wrapper_content: (i, element, album_num, album_title, image_folder, image_file, total_images) => {
return `<img class='img' style="width: 20px; height: 20px; margin: auto; margin-top: 50px; background-color: transparent; box-shadow: none;" data-src='${ image_folder + image_file }' src='img/spinner.gif'>`;
},
// Include necessary closing tag(s).
images_wrapper_close: "</div>" +
"</div>",
/* --- */
// GRID THUMBNAILS: Create a custom container for your thumbnails. The closing tag(s) go in their own object "grid_wrapper_close", see below. The default is one div closing tag, so if you do not include a closing tag here, that's what it will default to, which may or may not be what you need: If your custom "grid_wrapper_close" requires something different or more than just a single closing div (</div>) tag, don't forget to include a proper "grid_wrapper_close" object below!
// "grid_wrapper_open" returns just about any value for use in your custom markup except for current image.
grid_wrapper_open: (element, album_num, album_title, image_folder, total_images) => {
return `<div class='bb-row'>` +
"<div class='bb-col'>" +
`<h3>${ album_title }</h3>` +
"</div>" +
"<div class='bb-rest'>";
},
// Build a thumbnail to be used for each image in respective album(s)
// "grid_wrapper_content" returns just about any value for use in your custom markup, including current image
grid_wrapper_content: (t, element, album_num, album_title, image_folder, image_file, total_images) => {
// return `<button type='button' class='thb i_${ t }'>${ t }</button>`;
return `<img class='thb i_${ t }' src='${ image_folder + "thb/" + image_file }'>`;
},
// Include necessary closing tag(s).
grid_wrapper_close: "</div>" +
"</div>",
/* --- */
// SCROLL THUMBNAILS: Build a thumbnail to be used for each image in respective album(s)
// "scroll" returns just about any value for use in your custom markup, including current image
scroll: (t, element, album_num, album_title, image_folder, image_file, total_images) => {
// return `<button type='button' class='test thb i_${ t }'>${ t }</button>`;
return `<img class='thb i_${ t }' src='${ image_folder + "thb/" + image_file }'>`;
},
/* --- */
// ALBUM MENU OPTIONS: Build a link for each album. To be used in album navigation menu.
// "album_navigation_menu" returns album_num and album_title for use in your custom markup
album_navigation_menu: (album_num, album_title) => {
return `<button class='n_${ album_num }'>${ album_title }</button>`;
}
}
};
const portfolio = new Gallery("portfolio", "js/images_database_min.json", portfolio_options);
</script>
</body>
</html>