Store ratio for determining stretch direction.
This commit is contained in:
parent
725cb85cdb
commit
291dba972f
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user