标签:
<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>
标签:
原文地址:http://www.cnblogs.com/qigege/p/5479151.html