How to resize images proportionally / keeping the aspect ratio?

前端 未结 18 1880
野趣味
野趣味 2020-11-22 13:58

I have images that will be quite big in dimension and I want to shrink them down with jQuery while keeping the proportions constrained, i.e. the same aspect ratio.

C

18条回答
  •  天涯浪人
    2020-11-22 14:25

    actually i have just run into this problem and the solution I found was strangely simple and weird

    $("#someimage").css({height:})
    

    and miraculously the image is resized to the new height and conserving the same ratio!

提交回复
热议问题