diff --git a/lib/web/magnifier/magnify.js b/lib/web/magnifier/magnify.js index debc96322ee71..c06d2fa19f0a7 100644 --- a/lib/web/magnifier/magnify.js +++ b/lib/web/magnifier/magnify.js @@ -59,6 +59,13 @@ define([ } function toggleZoomable($image, flag) { + var minHeight, + minWidth, + height = $image.height(), + width = $image.width(), + parentHeight = $image.parent().height(), + parentWidth = $image.parent().width(); + if (flag) { $image.css({ 'min-width': $image.width(), @@ -75,6 +82,22 @@ define([ right: '', bottom: '' }).removeClass(imageZoommable); + + //For iPad/iPhone rotation changing + if (width > parentWidth || height > parentHeight) { + + if (width / height < parentWidth / parentHeight) { + minHeight = parentHeight; + minWidth = width * (parentHeight / height); + } else { + minWidth = parentWidth; + minHeight = height * parentWidth / width; + } + $image.css({ + 'min-width': minWidth, + 'min-height': minHeight + }); + } } } @@ -685,6 +708,7 @@ define([ } $(window).resize(function () { + toggleZoomButtons($image); if ($image.hasClass(imageZoommable) && !allowZoomOut) { resetVars($image); }