We have all seen the slide out draws that conceal content and slide out when clicked. This is a good method for saving space on a website or only presenting that information that the viewer wishes. Now all the goodness of this can be yours with some very simple xajax. In this example, we provide the basics, you could add effects to the slide feature if you like d with your favourite javascript library.


/*** include the xajax libs ***/
include 'xajax/xajax_core/xajax.inc.php';
 * @show draw contents
 * @return object
function SlideoutDrawer($show)
$objResponse=new xajaxResponse();
/*** assign the content display style to block ***/
/*** set the string to a hide message ***/
$str="<div onClick=\"xajax_SlideoutDrawer('false');\">Click to collapse.</div>";
/*** assign the content display style to none ***/
/*** set the string to a show message ***/
$str="<div onClick=\"xajax_SlideoutDrawer('true');\">Click to expand.</div>";
/*** assign the string to the inner HTML of the showhide div ***/
/*** return the response object ***/
return $objResponse;

/*** a new xajax object ***/ 
$xajax=new xajax();
/*** register the show function ***/
/*** stuff the xajax javascript into a variable ***/
$xajax_js $xajax->getJavascript('/xajax');

<title>QRdvark Xajax Draw</title>
<?php echo $xajax_js?>

<style type="text/css">
    display: none;
    border: solid 1px black;
    background-color: #c0c0c0;
    width: 300px;
.control {
    background-color:  #fff6d7;
    display: block;
    border: solid 1px black;
    width: 300px;
<hr />
<div class="control" id="showhide" onClick="xajax_SlideoutDrawer('true');">Click here to expand.</div>
<div class="content" id="content">
<h3>Draw Content</h3>
<p>Lots of content here</p>
<p>Lots of content here</p>
<p>Lots of content here</p>
<p>Lots of content here</p>
<p>Lots of content here</p>
<p>Lots of content here</p>