natashawylie / iviewer

image viewer plugin for jquery
233 stars 97 forks source link

iviewer with lightbox using method center #17

Closed Elodie1 closed 12 years ago

Elodie1 commented 12 years ago

Hello,

I'm using iviewer with the lightbox demo, it's working great execpt that I can't seems to be able to use any method or option. I want to load the image with a zoom of 50% instead of fit, it's all fine just I can't understand how to call the center() function. Because my image being smaller than the container I want is center by default. I'm sure it's very easy but I try everything and it never work.

I also try to set a max zoom and min zoom but it doesn't work.

I use the example for lightbox and almost didn't change anything.

var viewer = $("#iviewer .viewer"). width(920). height(560). iviewer({ src : src, ui_disabled : true, zoom : '50%', zoom_min: '50%', zoom_max: '300%', initCallback : function() { var self = this;

            },
            onZoom : function() {
                if (!firstZoom) return;

                $("#iviewer .loader").fadeOut();
                $("#iviewer .viewer").fadeIn();
                firstZoom = true;
            }
        }
    );

Thanks for the help.

Elodie1 commented 12 years ago

Ok I finally figure out how to center the image and fix the min-zoom. But I still have an issue which apparently is also in the lightbox example.When I open the lightbox an image and begin to zoom, if after I close the lightbox and reopen it the zoom hasn't been reset.

How can I be sure that the new image load is set to his origin size and not using the previous zoom parameter. Because I block the zoom to 300%. And if the new image load and is already open with a zoom 200% it take this size as the zoom_base and leave me the posibility to zoom again 300%.

I think it's quite an important issue because it make sense that the image is reset if you close the lightbox.

can3p commented 12 years ago

Thanks for the report, I'll look into it

can3p commented 12 years ago

I've fixed lightbox example to show, how can this be done. Please, check out the master branch.

Elodie1 commented 12 years ago

That's great! Thanks very much!