使用 Jquery 删除 Resizable Div 的纵横比

Remove Aspect Ratio of Resizable Div Using Jquery

我有一个简单的div。

<div id="resize" style="border:1px solid black"></div>

我通过 Jquery UI Plugin 使它可以调整大小。请参阅下面的代码:

var w = $('#resize').width();
var h = $('#resize').width();       

$('#resize').resizable({    
    animate: true,
    helper: 'ui-resizable-helper',
    aspectRatio:  w / h
});     

我想在 运行 时间内删除其纵横比功能,但仍可调整大小。我将如何做?

api documentation 那里你可以读到它可以在初始化后设置

var myValue = true;
$( ".selector" ).resizable( "option", "aspectRatio", myValue );