From b358bddb10d0cbce78b9d38e29fd7f816a7f4f62 Mon Sep 17 00:00:00 2001 From: saicaca Date: Tue, 6 Aug 2024 22:21:25 +0800 Subject: [PATCH] perf: preload PhotoSwipe instead of waiting for user click --- src/layouts/Layout.astro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 557b9b8..073acaa 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -321,11 +321,12 @@ import PhotoSwipeLightbox from "photoswipe/lightbox" import "photoswipe/style.css" let lightbox: PhotoSwipeLightbox +let pswp = import("photoswipe") function createPhotoSwipe() { lightbox = new PhotoSwipeLightbox({ gallery: ".custom-md img, #post-cover img", - pswpModule: () => import("photoswipe"), + pswpModule: () => pswp, closeSVG: '', zoomSVG: '', padding: { top: 20, bottom: 20, left: 20, right: 20 },