gpt4 book ai didi

javascript - 调整大小时,Jquery Resizable Div 宽度和高度变为 0

转载 作者:数据小太阳 更新时间:2023-10-29 06:10:42 26 4
gpt4 key购买 nike

我有这个代码:

<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 选项时,divwidthheight 调整大小为 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com