Skip to content

Commit 359d70e

Browse files
committed
add photoswipe to config files
1 parent cb19aca commit 359d70e

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

_config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,13 @@ third_party_libraries:
522522
url:
523523
js: "https://cdn.jsdelivr.net/npm/mermaid@{{version}}/dist/mermaid.min.js"
524524
version: "10.7.0"
525+
photoswipe:
526+
integrity:
527+
js: "sha256-VCBpdxvrNNxGHNuTdNqK9kPFkev2XY7DYzHdmgaB69Q="
528+
url:
529+
css: "https://cdn.jsdelivr.net/npm/photoswipe@{{version}}/dist/photoswipe.min.css"
530+
js: "https://cdn.jsdelivr.net/npm/photoswipe@{{version}}/dist/photoswipe.esm.min.js"
531+
version: "5.4.4"
525532
polyfill:
526533
url:
527534
js: "https://cdnjs.cloudflare.com/polyfill/v{{version}}/polyfill.min.js?features=es6"

_includes/head.liquid

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,15 @@
131131
integrity="{{ site.third_party_libraries.img-comparison-slider.integrity.css }}"
132132
crossorigin="anonymous"
133133
>
134+
{% endif %}
135+
<!-- Photoswipe -->
136+
{% if page.images.photoswipe %}
137+
<link
138+
defer
139+
rel="stylesheet"
140+
href="{{ site.third_party_libraries.photoswipe.url.css }}"
141+
crossorigin="anonymous"
142+
>
134143
{% endif %}
135144
<!-- Image slider -->
136145
{% if page.images.slider %}

_scripts/photoswipe-setup.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
permalink: /assets/js/photoswipe-setup.js
3+
---
4+
import PhotoSwipeLightbox from "{{ site.third_party_libraries.photoswipe-lightbox.url.js }}";
5+
import PhotoSwipe from "{{ site.third_party_libraries.photoswipe.url.js }}";
6+
const photoswipe = new PhotoSwipeLightbox({
7+
gallery: ".pswp-gallery",
8+
children: "a",
9+
pswpModule: PhotoSwipe,
10+
});
11+
photoswipe.init();

0 commit comments

Comments
 (0)