gpt4 book ai didi

javascript - 如何自动调整选项卡的高度以适合内容

转载 作者:行者123 更新时间:2023-11-28 17:09:33 24 4
gpt4 key购买 nike

<分区>

当日历在选项卡中弹出时,我希望选项卡能够调整到其中内容的高度。这是我的代码。谢谢!

  <script>
$(function(){
$( "#accordion-1" ).accordion({collapsible: true,
heightstyle: "content"});

$("#enable").click(function(){
$("#accordion-1").accordion("option", "disabled", false);
$("#accordion-1").accordion("option", "active", 2);
});

$("#disable").click(function(){
$("#accordion-1").accordion("option", "disabled", true);
});
});

$(function() {
$( "#datepicker-1" ).datepicker();
});
$(function() {
$( "#datepicker-2" ).datepicker();
});

</script>


<div id="accordion-1" >
<h3>Tab 1</h3>
<div>
Departure City: <input id="dep"></input>
Arrival City: <input id="arr"></input>
</div>
<h3>Tab 2</h3>
<div id="select_date" >
Onward Departure Date: <input id="datepicker-1"></input>
Return Departure Date: <input id="datepicker-2"></input>
</div>
<h3>Tab 3</h3>
<div>
Traveler 1: <input id="name1"></input>
Traveler 2: <input id="name2"></input>
</div>
</div>

单击 Accordion 样式选项卡中的输入部分时,会弹出一个日期选择器以选择日期。我希望选项卡能够调整到内容高度以适应日期选择器。关于如何完成这项工作的任何想法?提前致谢

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