I've got a bit of javascript that is just not working in IE.
function resize($img) {
var max_size_w = 200;
var max_size_h = 200;
var h = $img.height();
var w = $img.width();
if (h > max_size_h) {
h = max_size_h;
w = Math.ceil($img.width() / $img.height() * max_size_h);
}
if (w > max_size_w) {
h = Math.ceil($img.height() / $img.width() * max_size_w);
w = max_size_w;
}
$img.css({ height: h, width: w });
}
$(window).load(function() {
// Size the images correctly
$(".personPictureImage").each(function() {
var $img = $(this).find("img");
$img.load(function() { resize($(this)); });
if($img.height())
resize($img);
});
});
In every other browser it resizes an image to fit in a 200x200 box. In IE I get a size of 30px by =28px. In chrome I get 200px by 142px.
I know IE has issues and is generally a horrible browser but I'm trying to support it anyway. How can I fix my code to work in IE?