diff --git a/web/js/011-display.js b/web/js/011-display.js index acbc9a1..cccf1fc 100644 --- a/web/js/011-display.js +++ b/web/js/011-display.js @@ -146,7 +146,7 @@ $(document).ready(function() { if (image.get(0) === this) $(window).bind("resize", scaleImage); container = $("#photo-view"); - if (image.css("width") !== "100%" && container.height() * image.width() / image.height() > container.width()) + if (image.css("width") !== "100%" && container.height() * image.attr("ratio") > container.width()) image.css("width", "100%").css("height", "auto").css("position", "absolute").css("bottom", 0); else if (image.css("height") !== "100%") image.css("height", "100%").css("width", "auto").css("position", "").css("bottom", ""); @@ -166,7 +166,7 @@ $(document).ready(function() { $(window).unbind("resize", scaleImage); photoSrc = photoFloat.photoPath(currentAlbum, currentPhoto, maxSize, false); $("#photo") - .attr("width", width).attr("height", height) + .attr("width", width).attr("height", height).attr("ratio", currentPhoto.size[0] / currentPhoto.size[1]) .attr("src", photoSrc) .attr("alt", currentPhoto.name) .attr("title", currentPhoto.date)