fancyapps / ui

A library of JavaScript UI components, includes the best lightbox - Fancybox5
https://fancyapps.com/
Other
819 stars 98 forks source link

Zoom doesn't work when image is max size #665

Closed megaarmos closed 5 months ago

megaarmos commented 5 months ago

Describe the bug

While using fancybox i can't toggle zoom on bigger devices where image is maximum size, but it can be toggled on smaller devices.

Reproduction

  1. Open JSFiddle - https://jsfiddle.net/0usoLz4h/
  2. Click on image
  3. Click on toggle full-screen mode
  4. Attempt to zoom, it should not work

Additional context

No response

fancyapps commented 5 months ago

Hi,

The script provides zoom functionality from the scaled size to the actual size by default. So if the image fits in the viewport, it is assumed that the content cannot be zoomed. If you want, you can increase the maximum zoom level, example -

Fancybox.bind('[data-fancybox]', {
  contentClick: "toggleMax",
  Images: {
    Panzoom: {
      maxScale: 2,
    },
  },
});    

https://jsfiddle.net/qycu51j3/