The problem: To make an image inside a plugin resize dynamically (H&W, proportionally) inside a div that gets shorter on window resize (there are essentially three areas: Top - static, bottom - static, middle - dynamic) with width:100%
and top:#px
bottom:#px
. The images must also ultimately only resize their set height (603x427)
Here's the page:
I'm pretty darn close, but what happens with the code below:
<script type="text/javascript">
$(window).resize(function() {
var hgt = $(window).height() - 427;
var wid = $(window).width() - 633;
$('.slides_container img').height(hgt);
$('.slides_container img').width(wid);
$('.slides_container').height(hgt-30);
$('.slides_container').height(hgt);
$('.vid').width($(window).width());
});
</script>
is the height of the image changes, as does the width, but they don't change proportionally. Instead, the width changes correctly, and the height changes correctly, but independent of one another. I want the images to remain proportional.
Legend: .slides_container
is part of the plugin and contains the image, .slides_container img
is the image, .vid
contains the .container
for centering. For the above code, $('.slides_container').height(hgt-30);
is to allow for pagination.