.fn.ImageAutoSize = function(width,height) { $(“img”,this).each(function() { var image = $(this); if(image.width()>width) { image.width(width); image.height(width/image.width()*image.height()); } if(image.height()>height) { image.height(height); image.width(height/image.height()*image.width()); } }); }
- 本文固定链接: http://www.web8899.com/2013/11/05/jquery自动根据图片高度宽度缩/
- 转载请注明: dean 于 迈向卓越-个人博客 发表