Currently facing a bit of an issue. I’m attempting to expand and retract the height of #inner upon clicking, with the intention for the height of #container to increase automatically without manually setting it to ‘auto’. Unfortunately, it seems that #container doesn’t enlarge as expected when set to ‘auto’. Any assistance on this matter would be greatly appreciated. Thank you in advance.
HTML:
<div id=‘container’>
<div id=‘inner’>This is the inner div</div>
</div>
Jquery:
function handler1() {
$(this).css('height', '+=65px');
$(this).one("click", handler2);
}
function handler2() {
$(this).css('height', ' -= 65px ');
$(this).one("click", handler1);
}
$("#inner").one("click", handler1);
CSS:
#container {
display: block;
width: 200px;
height: auto;
}
#inner {
height: auto;
}