From 4607c2521ef354302cc11e2add3d9c2dd1fb37d1 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 5 Feb 2009 20:44:24 +0000 Subject: Improve the close icon so it doesn't look as much like an envelope. Also add resizing to the fullsize image if the windo size changes. --- core/js/fullsize.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'core/js/fullsize.js') diff --git a/core/js/fullsize.js b/core/js/fullsize.js index 91e43529..df5bcf19 100644 --- a/core/js/fullsize.js +++ b/core/js/fullsize.js @@ -27,6 +27,17 @@ $(document).ready(function() { $("#gFullsizeOverlay*").remove(); $("#gFullsize").remove(); }); + $(window).resize(function() { + $("#gFullsizeOverlay").width($(document).width()); + $("#gFullsizeOverlay").height($(document).height()); + image_size = _auto_fit(fullsize_detail.width, fullsize_detail.height); + $("#gFullsize").height(image_size.height); + $("#gFullsize").width(image_size.width); + $("#gFullsize").css("top", image_size.top); + $("#gFullsize").css("left", image_size.left); + $("#gFullSizeImage").height(image_size.height); + $("#gFullSizeImage").width(image_size.width); + }); }); }); @@ -52,6 +63,8 @@ function _auto_fit(imageWidth, imageHeight) { imageHeight *= ratio; } - return {top: (windowHeight - imageHeight) / 2, left: (windowWidth - imageWidth) / 2, - width: imageWidth, height: imageHeight}; + // handle the case where the calculation is almost zero (2.14e-14) + return {top: ((windowHeight - imageHeight) / 2).toFixed(2), + left: ((windowWidth - imageWidth) / 2).toFixed(2), + width: imageWidth.toFixed(2), height: imageHeight.toFixed(2)}; } -- cgit v1.2.3