I've got a div sidebar with a toggle button which makes it slide out from the left. I've searched the web for a Jquery script that will allow me to close this sidebar from clicking anywhere on the webpage and can't find anything that will work for me.
Below is the existing jQuery i'm using:
$(document).ready(function(){
$('.toggle_sidebar').click(function(){
$('#sidebar_extended').toggle("500");
});
});
CSS:
#sidebar_extended{
width:180px;
position:absolute;
min-height: 100%;
height:100%;
left:0;
margin:0 10px 0 0;
padding:0;
background:#3a3b3c;
display: none;
z-index: 5000;
color: #fff;
text-indent: 10px;}
HTML:
<div id="toggle">
<a href="#sidebar_extended" class="toggle_sidebar">
<img src="images/toggle.png" alt="toggle">
</a>
</div>
<div id="sidebar_extended">
Sidebar content
</div>