Felix Felix - 1 year ago 86
Javascript Question

How to resize image with correct propotion in x and y axis using jquery resizable

Hi please see this https://jsfiddle.net/felixtm/x3xb2jwf/15/. Here i can change the size of the image . is it possible to resize the image proportionally with x and y axis ? currently i can enlarge the image to y axis without effecting the x axis . I want to change the image size that is proportional with both x and y axis.

i see this code in documentation

$( ".selector" ).resizable({
aspectRatio: true

i used
aspectRatio: true
,but nothing changing .

Answer Source

The aspectRatio of resizable() is exactly what you need. I can only presume you're not setting it on the correct element, try this:

    aspectRatio: true

Updated fiddle

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download