jQuery(document).ready(function()
{
/* The picture is not completely scaled down automatically*/
$(window).load(function(){$('#content div.thumbnail img').each(function(){ var x = 200;
//Fill in the target image width
var y = 140;
//Fill in the target image height
var w=$(this).width(), h=$(this). height();
//Get the image width and height
if (w > x) {
//When the image width is greater than the target width
var w_original=w, h_original=h; h = h * (x / w);
//Calculate the height proportionally based on the target width w =x;
//The width is equal to the predetermined width if (h < y) {
//If reduced proportionally When the final height is less than the predetermined height
w = w_original * (y /h_original);
// Recalculate the width according to the target height h = y;
// The height is equal to the predetermined height
}
}
$(this).attr({width:w,height:h}); }); }); });