<script type="text/javascript"> var ObjImg = jQuery(".Dy_Content img"); for (var i = 0; i < ObjImg.length; i++) { loadImage(ObjImg.eq(i)); } function loadImage(Obj) { var b_width = 320; var img = new Image(); img.src = jQuery(Obj).attr("src"); if (img.complete) { var i_width = img.width; var i_height = img.height; if (i_width > b_width) { var bx = b_width / i_width; jQuery(Obj).width(b_width); jQuery(Obj).height((bx * i_height).toFixed(0)); } return; } img.onload = function () { var i_width = this.width; var i_height = this.height; if (i_width > b_width) { var bx = b_width / i_width; jQuery(Obj).width(b_width); jQuery(Obj).height((bx * i_height).toFixed(0)); } }; }; </script>
时间: 2024-10-06 05:22:01