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)
|
if (image.get(0) === this)
|
||||||
$(window).bind("resize", scaleImage);
|
$(window).bind("resize", scaleImage);
|
||||||
container = $("#photo-view");
|
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);
|
image.css("width", "100%").css("height", "auto").css("position", "absolute").css("bottom", 0);
|
||||||
else if (image.css("height") !== "100%")
|
else if (image.css("height") !== "100%")
|
||||||
image.css("height", "100%").css("width", "auto").css("position", "").css("bottom", "");
|
image.css("height", "100%").css("width", "auto").css("position", "").css("bottom", "");
|
||||||
@ -166,7 +166,7 @@ $(document).ready(function() {
|
|||||||
$(window).unbind("resize", scaleImage);
|
$(window).unbind("resize", scaleImage);
|
||||||
photoSrc = photoFloat.photoPath(currentAlbum, currentPhoto, maxSize, false);
|
photoSrc = photoFloat.photoPath(currentAlbum, currentPhoto, maxSize, false);
|
||||||
$("#photo")
|
$("#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("src", photoSrc)
|
||||||
.attr("alt", currentPhoto.name)
|
.attr("alt", currentPhoto.name)
|
||||||
.attr("title", currentPhoto.date)
|
.attr("title", currentPhoto.date)
|
||||||
|
Loading…
Reference in New Issue
Block a user