title: Click anywhere outside of toggle div to close
body: <p>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.</p>
  
  <p>Below is the existing jQuery i'm using:</p>
  
  <pre><code>$(document).ready(function(){
  $('.toggle_sidebar').click(function(){
      $('#sidebar_extended').toggle("500");
  });
      });
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>#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;}
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div id="toggle"&gt;
    &lt;a href="#sidebar_extended" class="toggle_sidebar"&gt;
      &lt;img src="images/toggle.png" alt="toggle"&gt;
    &lt;/a&gt;
  &lt;/div&gt;
  
  &lt;div id="sidebar_extended"&gt;
    Sidebar content
  &lt;/div&gt;
  </code></pre>