How to avoid the enlarge function of the PhotoSwipe lightbox?

Permalink Browser Info Environment
Hi,

I'm using the latest version of Grand Gallery with the PhotoSwipe lightbox. I would like to get rid of the enlarge functionality (plus icon) of the PhotoSwipe lightbox image. I would just like to have the grab cursor for swiping, not the enlargement. Is there a way to achieve this?

Thank you,
Michael

Type: Ticket
Status: In Progress
okapi
View Replies:
Parasek replied on at Permalink Reply
Parasek
Hi,

currently you can't do it using UI, but you can modify file:
packages/grand_gallery/blocks/grand_gallery/js_files/photo-swipe.js

Add this code in line 246

getDoubleTapZoom: function(isMouseClick, item) {
   return item.initialZoomLevel;
},


and you have to add somewhere CSS code (it can be in page template, block template or paste it in /dashboard/system/seo/codes):

<style>
    .gg-photo-swipe-wrapper.pswp--zoom-allowed .pswp__img {
        cursor: grab !important
    }
</style>


You can also disable zoom icon in /dashboard/grand_gallery/basic_settings
In "Lightbox settings" section
okapi replied on at Permalink Reply
okapi
Thank you so much for your fast and helpful reply! I'm very happy with this solution!
Would it make sense to put such overrides in a custom block template?

May I also ask you how I would add the option "Click on image moves to the next slide"?
My attempts to achieve this with a similar approach have failed so far.
Parasek replied on at Permalink Reply
Parasek
1. View file is fine for styles.
I don't think you can override photo-swipe.js just by pasting it somewhere else.

2. You have to add this code around line 288 in packages/grand_gallery/blocks/grand_gallery/js_files/photo-swipe.js,
just below "gallery.init();"

// Go to next image when image in lightbox is clicked
gallery.listen('close', function() {
   $('.gg-photo-swipe-wrapper').off('click', '.pswp__img');
});
$('.gg-photo-swipe-wrapper').on('click', '.pswp__img', function(){
   gallery.next();
});


Remember though, that after package update you will have to make those changes again.
okapi replied on at Permalink Reply
okapi
Thank you very much for the code, that helped me a lot.
Your support is amazing!

concrete5 Environment Information

Concrete CMS 9.2.1

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.