make div box shrink and grow with show and hide
Hi
I am currently building a website for a client and within the search form, I have more options which is a link that shows and hides more options to search by and it works perfect but I want the div box to shrink and grow when the more options link is clicked
my coding for the html and javascript is below
Code:
<a onclick ="javascript:ShowHide('HiddenDiv')" href="javascript:;" >More Options</a>
<button class="ui-button ui-button-big js-submit"><?php _e("Search", 'bender');?></button>
<br />
<div class="mid" id="HiddenDiv" style="DISPLAY: none" >
<div style="float: right; margin: 0 0 0 10px;">
<?php $doors = Params::getParam('doors') ; ?>
<input style="width:20px;" type="radio" name="doors" value="3" id="3" <?php if($doors == '3') { echo 'checked="yes"'; } ?>/> <label for="3"><?php _e('3 Doors', 'cars_attributes'); ?></label>
<input style="width:20px;" type="radio" name="doors" value="4" id="4" <?php if($doors == '4') { echo 'checked="yes"'; } ?>/> <label for="4"><?php _e('4 Doors', 'cars_attributes'); ?></label>
</div>
<input type="text" id="engine_size" name="engine_size" style="float: left;" placeholder="Engine Size"/>
<input type="text" name="extColr" id="extColr" style="float: left;" placeholder="Colour"/>
</div>
<script language="JavaScript">
function ShowHide(divId)
{
if(document.getElementById(divId).style.display == 'none')
{
document.getElementById(divId).style.display='block';
}
else
{
document.getElementById(divId).style.display = 'none';
}
}
</script>
The CSS is below
Code:
.main-search {
background-color: #f0f0f0;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f0f0f0), color-stop(100%, #c9c9c9));
background-image: -webkit-linear-gradient(top, #f0f0f0, #c9c9c9);
background-image: -moz-linear-gradient(top, #f0f0f0, #c9c9c9);
background-image: -ms-linear-gradient(top, #f0f0f0, #c9c9c9);
background-image: -o-linear-gradient(top, #f0f0f0, #c9c9c9);
background-image: linear-gradient(top, #f0f0f0, #c9c9c9);
width: 892px;
padding: 6px;
height: 138px;
border: solid 1px #989393;
margin: 0 auto;
box-shadow: inset 0px 1px 1px 0px #fff, 0px 2px 2px 0px rgba(0,0,0,0.2);
position: relative;
margin-top: 15px;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px
}
I believe it is to do with the height: 138px line but not 100% but have tried min-height, max-height, no height, height: auto and nothing seems to work
Please help as can't see where I am going wrong with it
Thank you in advance