• Resolved macglide

    (@macglide)


    Hi,

    I really like the plugin but I would like to customize some aspects.

    PhotoSwipe offers different settings for zoom levels:

    initialZoomLevel - zoom level when photoswipe is opened.
    secondaryZoomLevel - zoom level when user clicks "zoom" button, double-taps image, or clicks an image. If it equals to initial - secondary zoom functionality is disabled.
    maxZoomLevel - maximum zoom level when user zooms via zoom/pinch gesture, via ctrl-wheel or via trackpad. Always highest among three.

    Can these values be somehow adjusted? As far as I understand, those values are set when PhotoSwipe is initialized. But as the plugin initializes PhotoSwipe, can these values still be changed afterwards without tempering with the plugin files?

    Thanks and best regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Arno Welzel

    (@awelzel)

    No, these valuies can not be changed currently, since there is no setting for this in the plugin. The settings used in the frontend code are:

    initialZoomLevel: 'fit',
    secondaryZoomLevel: 'fill',
    maxZoomLevel: 2,

    This follows the default settings for PhotoSwipe 5 with a little adjustment.

    Initial zoom level is “fit”: when opening an image, it will always fit the screen – that is what most people expect, when opening a lightbox and this is also how all image lightbox scripts usually work. Changing this to any other level which will make the image be bigger as the viewport, would be confusing for many visitors.

    Secondary zoom level is “fill”: when an image is bigger than the current viewport, you can zoom in one step and the image will either be it exactly as wide as the current viewport is and you can scroll up/down or the image will be as high as the viewport and you can scroll left/right.

    The maximum zoom level is 200% of the original size, so you can even zoom on further if needed using the mouse wheel or a pinch-to-zoom-gesture on touchscreens. But more than 200% makes not a lot of sense, since bitmap images will only pixelate when zooming in further.

    Maybe a customization will be added in the future – but I am reluctant to do so yet, since this will cause other support questions, because people mess with these parameters and may end up with a very strange behaving lightbox (like initial zoom is bigger then the secondary zoom level etc.).

    Thread Starter macglide

    (@macglide)

    Thanks for your reply!

    For now, I just adjusted the values in wp-content/plugins/lightbox-photoswipe/assets/ps5/frontend.min.js to

    initialZoomLevel:'fit',secondaryZoomLevel:1,maxZoomLevel:1

    to achieve the desired behavior, as I want a 100% zoom when clicking on an image (like in many image editing software)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Zoom Levels’ is closed to new replies.