Add pinch zoom for mobile devices

Our clients want to zoom into images they click on from our photo galleries but when they do they are unable to pinch zoom on mobile and only have the option of the plus and minus signs which are cumbersome. Is there a simple solution to make pinch zoom possible on images once they have been clicked on?

1 Like

Hi there, @Danielle_Adnitt :wave:

Great thought, thanks for sharing! If more users support this request, it might be considered in the future :slightly_smiling_face:

While this feature isn’t released yet, our devs shared a custom solution. This script should be added to the Custom JS section on the Style tab of your widget’s settings :slightly_smiling_face:

const preventSlideSwitchWhileZooming = (event) => {
  if (
    event.target?.closest('#fslightbox-container') &&
    event.touches.length > 1
  ) {
    event.stopImmediatePropagation();
  }
};

document.addEventListener('touchstart', preventSlideSwitchWhileZooming);
document.addEventListener('touchmove', preventSlideSwitchWhileZooming);
document.addEventListener('touchend', preventSlideSwitchWhileZooming);
1 Like