summaryrefslogtreecommitdiff
path: root/core/js
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-02-05 20:44:24 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-02-05 20:44:24 +0000
commit4607c2521ef354302cc11e2add3d9c2dd1fb37d1 (patch)
treee1a4fd6e286ed0bfc01f74506c7ec7b27cde9589 /core/js
parent6a8daaef5e2df4a98e1f47d4f4107c00c03d9498 (diff)
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.
Diffstat (limited to 'core/js')
-rw-r--r--core/js/fullsize.js17
1 files changed, 15 insertions, 2 deletions
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)};
}