jQuery UI Resizable:以编程方式设置大小? [英] jQuery UI Resizable: set size programmatically?

查看:59
本文介绍了jQuery UI Resizable:以编程方式设置大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,用户输入宽度和高度值以告诉小部件将尺寸调整为该尺寸.如何实现呢?

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

推荐答案

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

您无需使用jqueryui的可调整大小即可在脚本中调整其大小. jQuery .css()方法适用于任何DOM元素.您也可以animate({width: 500},1000).

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).

这篇关于jQuery UI Resizable:以编程方式设置大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆