﻿/*自动根据图片高度宽度缩小*/
jQuery.fn.ImageAutoSize = function (width, height) {
    $("img", this).each(function () {
        var image = $(this);
        if (image.width() > width && width > 0) {

            image.height(width / image.width() * image.height());
            image.width(width);
        }
        if (image.height() > height && height > 0) {

            image.width(height / image.height() * image.width());
            image.height(height);
        }
    });
}
