summaryrefslogtreecommitdiffci
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
-rw-r--r--internal/lightgallery/html_renderer.go47
-rw-r--r--views/pages/blog-page.html16
2 files changed, 24 insertions, 39 deletions
diff --git a/internal/lightgallery/html_renderer.go b/internal/lightgallery/html_renderer.go
index 17a6f2b..e20e9ec 100644
--- a/internal/lightgallery/html_renderer.go
+++ b/internal/lightgallery/html_renderer.go
@@ -92,35 +92,32 @@ func (r *LightGalleryHTMLRenderer) renderLightGallery(w util.BufWriter, source [
w.WriteString(fmt.Sprintf(`
<script>
function createLightGallery%s() {
- const $lgContainer = document.getElementById('lg-%s');
- const config = {
- container: $lgContainer,
- dynamic: true,
- dynamicEl: [%s],
- width: "100%%",
- height: "50vmin",
- hash: false,
- closable: false,
- showMaximizeIcon: true,
- appendSubHtmlTo: ".lg-sub-html",
- isMobile: () => false,
- slideDelay: 0,
- plugins: [lgZoom, lgThumbnail],
- thumbWidth: calculateVmin(10),
- thumbHeight: "10vmin",
- thumbMargin: 4
- };
- const inlineGallery = lightGallery($lgContainer, config);
+ const $lgContainer = document.getElementById('lg-%s');
+ const inlineGallery = lightGallery($lgContainer, {
+ container: $lgContainer,
+ dynamic: true,
+ dynamicEl: [%s],
+ width: "100%%",
+ height: "50vmin",
+ hash: false,
+ closable: false,
+ showMaximizeIcon: true,
+ appendSubHtmlTo: ".lg-sub-html",
+ isMobile: () => false,
+ slideDelay: 0,
+ plugins: [lgZoom, lgThumbnail],
+ thumbWidth: calculateVmin(10),
+ thumbHeight: "10vmin",
+ thumbMargin: 4
+ });
- setTimeout(() => {
- inlineGallery.openGallery();
- }, 200);
-
- galleryMap.set(inlineGallery, createLightGallery%s);
+ setTimeout(() => {
+ inlineGallery.openGallery();
+ }, 200);
}
document.addEventListener('DOMContentLoaded', createLightGallery%s);
-</script>`, galleryID, galleryID, strings.Join(dynamicElements, ","), galleryID, galleryID))
+</script>`, galleryID, galleryID, strings.Join(dynamicElements, ","), galleryID))
}
return ast.WalkContinue, nil
diff --git a/views/pages/blog-page.html b/views/pages/blog-page.html
index d685fda..83860d7 100644
--- a/views/pages/blog-page.html
+++ b/views/pages/blog-page.html
@@ -12,10 +12,6 @@
height: 100% !important;
}
</style>
-
-<script>
- const galleryMap = new Map();
-</script>
{{ end }}
{{ define "body" }}
@@ -74,18 +70,10 @@
{{ .MapLocationAreaMeters }}
)});
- let resizeTimeout;
window.addEventListener('resize', function() {
- clearTimeout(resizeTimeout);
- resizeTimeout = setTimeout(() => {
+ setTimeout(() => {
map.invalidateSize();
- var oldGalleryMap = new Map(galleryMap);
- oldGalleryMap.forEach((createFunc, g, map) => {
- galleryMap.delete(g);
- g.destroy();
- createFunc();
- });
- }, 300);
+ }, 100);
});
</script>
{{- end }}