1

I have a script that resizes an image/div dynamically on window resize, but if the viewer opens the window less than full, the image is too large for the viewing area. Here's what I've got (you might find this familiar):

<script typ="text/javascript">
        $(window).resize(function() {
            var hgt = $(window).height() - 427;
            var wid = $(window).width() - 603;
            $('.slides_container img').css({
                width:'auto',
                height:hgt,
            });
            $('.slides_container img').css("max-height", 427);
            $('.slides_container img').css("max-width", 603);
            $('.slides_container').css("width", '100%');
            $('.slides_container').height(hgt-10);
        });
    </script>
4

1 回答 1

-1

将以下代码放在 </script> 上方:

$(document).ready($(window).resize());
于 2012-04-09T19:31:15.613 回答