I have created a jQuery plugin to handle expand and close functionality of searchbar. This would help some to minimize their work, since it is straight forward to use.
Download the files from github.
Add javascript ( jquery.searchbox.js ) and css ( searchbox.css ) files in your html document. Create a div in your document and initiate the plugin.
<div class="search"></div>
Plugin Initiation:
$(".search").searchbox({ name: "search", method: "POST", url: "someurl.php", placement: "right", ajax: true, ajaxOptions: { success: function(success){ alert(success); }, error: function(error){ alert(error); } } });
Demo: