Toggle sidebar in bootstrap TbMenu

Hello,

I am using yii booster TbMenu to be displayed as sidebar. Here is the link:Booster TbMenu

The basic code for it is:


<div class="span-5 last">

	<div id="sidebar" >

       

	<?php

		    $this->widget(

    'bootstrap.widgets.TbMenu',

    array(

    'type' => 'list',


    'items' => array(

   .......

   .......

    )

    )

    );

	?>

	</div><!-- sidebar -->

	</div>

Is it possible to make a toggle kinda button to hide and show the sidebar?

Thanks in Advance.

Yes, you can use jQuery to add event to button to toggle the sidebar:

HTML/PHP:


<button id="button-sidebar">Toggle Sidebar</button>

JavaScript:


jQuery("#button-sidebar").click(function() {

    	jQuery("#sidebar").toggle();

}

Thanks for the reply.

I have used this extension: Sidebar and it works like charm.

Really easy to use awesome widget.