dimsemenov / PhotoSwipe

JavaScript image gallery for mobile and desktop, modular, framework independent
http://photoswipe.com
MIT License
24.24k stars 3.31k forks source link

Multiple zoom level #1416

Open madeinside opened 7 years ago

madeinside commented 7 years ago

Hi ! Great plugin that works surprisingly well cross-device ! Thanks a lot for giving such great work for free !

Is it possible to have multiple zoom level on an image ? Likes so : Thumbnail > Small > Medium > Big So once a click is performed on a thumbnail it opens the Small images and further clicks on the opened image (or zoom button) will load the Medium, then the Big and then return to the small ?

Thanks in advance !

kiwinewt commented 6 years ago

I have done this by:

        getDoubleTapZoom: function(isMouseClick, item) {

            if(!item.zoomLevel) {
                item.zoomLevel = item.initialZoomLevel
            }

            var res;

            if(item.zoomLevel < 0.5) {
                res = 0.5
            } else if(item.zoomLevel < 1) {
                res = 1
            } else if(item.zoomLevel < 1.5) {
                res = 1.5
            } else if(item.zoomLevel < 2) {
                res = 2
            } else if(item.zoomLevel < 2.5) {
                res = 2.5
            } else {
                res = item.initialZoomLevel
            }

            item.zoomLevel = res;
            return res;
        }
maxgreenhalgh commented 4 years ago

This is very helpful, however it's only working on the first two images for me.

vistree commented 1 year ago

Hi, I also need a multi level zoom in / zoom out. Best with 2 different buttons. Is this somehow possible with current library version?