我有这个脚本可以在悬停时放大图像缩略图。
问题是某些图像的高度不同,因此脚本有时会将它们拉伸得不成比例。大多数图像是 100x100,但有时它们是 100x140,等等。
有没有办法在调整大小时保留图像尺寸?
$("ul.gallery-large li").hover(function () {
$(this).find('img').addClass("hover").stop()
.animate({
width: '200px',
height: '200px',
}, 200);
}, function () {
$(this).find('img').removeClass("hover").stop()
.animate({
width: '100px',
height: '100px'
}, 400);
});