Moved from Fancybox to Photoswipe for click-to-zoom

This commit is contained in:
Christoph Haas 2025-05-08 01:10:03 +02:00
parent aaf1eb34c4
commit 9164e2a636
10 changed files with 3178 additions and 28 deletions

View file

@ -2,6 +2,16 @@
// import "@hotwired/turbo-rails"
// import "controllers"
// import Lightbox from "photoswipe";
import PhotoSwipeLightbox from "photoswipe/lightbox";
const lightbox = new PhotoSwipeLightbox({
gallery: "#gallery",
children: "a.foobar",
pswpModule: () => import("photoswipe"),
});
lightbox.init();
// Initialize the upload form.
function upload_form_init() {
// Disable the submit button if Javascript is supported.
@ -124,6 +134,25 @@ function display_error(msg) { console.log("foo");
`;
}
// function init_fancybox()
// {
// Fancybox.bind("[data-fancybox]", {
// // Your custom options
// // prevEffect : 'none',
// // nextEffect : 'none',
// // helpers : {
// // title : {
// // type: 'outside'
// // },
// // thumbs : {
// // width : 50,
// // height : 50
// // }
// // }
// });
// console.log("binding done")
// };
document.addEventListener("DOMContentLoaded", () => {
console.log("DOM loaded");
@ -140,4 +169,6 @@ document.addEventListener("DOMContentLoaded", () => {
// document.onpaste = upload_paste_handler(element.dataset.uploadUrl);
document.onpaste = function(event) { upload_paste_handler(event, element.dataset.uploadUrl); }
}
// init_fancybox();
});