我有<div>根据父母<div>身高动态改变孩子身高的问题
这是示例
<div id="parent" style="height:600px">
<div id="children"></div>
</div>
和js
var mapWidth = $("#parent").height() - 50;
var sidebarWith = $("#children").height();
if (sidebarWith > mapWidth) {
$("#children").height(mapWidth);
} else {
$("#children").height(sidebarWith);
}
父母<div>有固定的高度,但孩子<div>使用 jQueryslideUp()和slideDown()函数改变他的高度。
如果孩子<div>的身高大于父母,我需要将孩子的高度设置<div>为父母<div>。另外,当我在孩子中滑动时<div>,如果孩子的<div>身高slideUp()低于父母<div>的身高,我需要将孩子的高度设置<div>为他的当前高度。
提前致谢。