mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-31 00:34:05 -06:00
Fixed GLightbox not reloaded in SPA mode
This commit is contained in:
parent
26674eef35
commit
02b5797a7c
@ -59,7 +59,14 @@ export const Lightbox: QuartzTransformerPlugin<Partial<Options>> = (userOpts) =>
|
|||||||
{
|
{
|
||||||
contentType: "inline",
|
contentType: "inline",
|
||||||
loadTime: "afterDOMReady",
|
loadTime: "afterDOMReady",
|
||||||
script: `const lightbox = GLightbox(${JSON.stringify(opts)});`,
|
// GLightbox needs to be reloaded whenever there's a page content change
|
||||||
|
// to make sure it loads all the images in the new page content.
|
||||||
|
// Ref: https://quartz.jzhao.xyz/advanced/creating-components#scripts-and-interactivity
|
||||||
|
script: `
|
||||||
|
document.addEventListener("nav", () => {
|
||||||
|
const lightbox = GLightbox(${JSON.stringify(opts)});
|
||||||
|
});
|
||||||
|
`.trim(),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user