jQuery UI Resizable: set size programmatically?

后端 未结 3 881

For example, user inputs width and height values to tell the widget to resize to that dimension. How to implement this?

3条回答
  •  醉话见心
    2021-01-15 11:08

    var w = prompt('width?')*1;
    var h = prompt('height?')*1;
    $('#resizable').css('width', w );
    $('#resizable').css('height', h );
    

    You don't need to use jqueryui's resizable in order to resize it in script. The jQuery .css() method applies for any DOM element. You can also animate({width: 500},1000).

提交回复
热议问题