I'm using the following javascript to resize image as window resizes which works correctly in all browsers except Chrome:
<!DOCTYPE html>
<html>
<head>
<style>
* {
padding: 0;
margin: 0;
}
.fit {
max-width: 100%;
max-height: 100%;
}
.center {
display: block;
margin: auto;
}
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" language="JavaScript">
function set_body_height()
{
var wh = $(window).height();
$('body').attr('style', 'height:' + wh + 'px;');
}
$(document).ready(function() {
set_body_height();
$(window).bind('resize', function() { set_body_height(); });
});
</script>
</head>
<body>
<img id="the_pic" class="center fit" src="pic.jpg" >
</body>
</html>
The problem with Chrome is that the image does not resize to fit the window size when the page first loads but when you resize the browser window after it loaded, the image then correctly resizes to the resized browser window.
Try clicking on http://www.mnhscs.com/christmas
Oddly this problem does not occur everytime the page is loaded in Chrome. Sometimes the image resizes correctly.