我有这个代码:
<table>
<tr>
<td id="parent">
<div id="child"></div>
</td>
</tr>
</table>
我的 JavaScript 代码:
$('#child' ).resizable({
animate: true,
helper: '.ui-resizable-helper',
maxWidth: 500,
maxHeight: 500,
aspectRatio: true
});
使用上面的代码,我的可调整大小的 div
按预期工作,但是当我添加 containment
选项时,div
的 width
和 height
调整大小为 0
,在任何方向调整大小时。
$('#child' ).resizable({
animate: true,
helper: '.ui-resizable-helper',
maxWidth: 500,
maxHeight: 500,
aspectRatio: true,
containment: '#parent'
});
为什么会这样?是错误吗?
最佳答案
尝试添加这个 CSS:
#parent {
width: 500px;
height: 500px;
}
关于javascript - 调整大小时,Jquery Resizable Div 宽度和高度变为 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34487353/