I have here some code which is working but it seems to be a lot of coding to do here. I would really appreciate if someone could make this simpler.
<!-- *********************************************** -->
<div class="widget search-w">
<div class="wrapper">
<div class="big-icon search icontap"><a class="widget-close" data-toggle="collapse" data-target="#search">click</a>
</div>
<div class="s-title"><a class="widget-close closeme">Close</a></div>
<div id="search" class="collapse in biz-widget">
<div>
<?php get_search_form(); ?>
<div class="widget-content">
<h4>Your recent searches</h4>
<ul>
<li><a href="">search 1</a></li>
<li><a href="">search 1</a></li>
<li><a href="">search 1</a></li>
<li><a href="">search 1</a></li>
<li><a href="">search 1</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- *********************************************** -->
<div class="widget favourite-w">
<div class="big-icon favourite icontap2"><a class="widget-close" data-toggle="collapse" data-target="#favourite">click</a></div>
<div class="s-title"><a class="widget-close closeme2">Close</a></div>
<div id="favourite" class="collapse in biz-widget">
<ul>
<li><a href="">favourite page</a></li>
<li><a href="">favourite page</a></li>
<li><a href="">favourite page</a></li>
<li><a href="">favourite page</a></li>
<li><a href="">favourite page</a></li>
</ul>
<div class="clearfix"></div>
</div> <!-- end #about -->
<div class="clearfix"></div>
</div>
and here is my js
$(".icontap").toggle(function(){
$("#search").animate({height:40},200).css( "overflow", "hidden" );
$(".search-w .widget-close").css("visibility","visible");
$(".search-w .biz-widget").css("border-color", "#335ccc");
},function(){
$("#search").animate({height: $("#search").get(0).scrollHeight}, 200 );
$(".search-w .widget-close").css("visibility","visible");
$(".search-w .biz-widget").css("border-color", "#335ccc");
});
$(".closeme").click(function(){
$("#search").animate({height:0},200);
$(".search-w .biz-widget").css("border-color", "#fff");
$(".search-w .widget-close").css("visibility","hidden");
});
/*******/
$(".icontap2").toggle(function(){
$("#favourite").animate({height:40},200).css( "overflow", "hidden" );
$(".favourite-w .widget-close").css("visibility","visible");
$(".favourite-w .biz-widget").css("border-color", "#335ccc");
},function(){
$("#favourite").animate({height: $("#favourite").get(0).scrollHeight}, 200 );
$(".favourite-w .widget-close").css("visibility","visible");
$(".favourite-w .biz-widget").css("border-color", "#335ccc");
});
$(".closeme2").click(function(){
$("#favourite").animate({height:0},200);
$(".favourite-w .biz-widget").css("border-color", "#fff");
$(".favourite-w .widget-close").css("visibility","hidden");
});
Or see this in fiddle.