title: How to drag the sidebar?
body: <p>I am unable to drag the sidebar left or right. I want to increase and decrease the sidebar when it is dragged to the right and the left. When I tried to increase or decrease the width of the sidebar, it remained the same. There were no changes happening in that.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var i = 0;
  $('#dragbar').mousedown(function(e) {
  
    e.preventDefault();
    $('#mousestatus').html("mousedown" + i++);
    $(document).mousemove(function(e) {
      $('#position').html(e.pageX + ', ' + e.pageY);
      $('#sidebar').css("width", e.pageX + 2);
      $('#main').css("left", e.pageX + 2);
    })
    console.log("leaving mouseDown");
  });
  $(document).mouseup(function(e) {
    $('#clickevent').html('in another mouseUp event' + i++);
    $(document).unbind('mousemove');
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#main {
    background-color: BurlyWood;
    float: right;
    position: absolute;
    top: 100px;
    bottom: 38px;
    right: 0;
    left: 200px;
  }
  #sidebar {
    background-color: IndianRed;
    width: 200px;
    float: left;
    position: absolute;
    top: 100px;
    bottom: 38px;
    overflow-y: hidden;
  }
  #footer {
    background-color: PaleGoldenRod;
    width: 100%;
    height: 38px;
    bottom: 0;
    position: absolute;
  }
  #header {
    background-color: wheat;
    width: 100%;
    height: 100px;
  }
  #dragbar {
    background-color: black;
    height: 100%;
    float: right;
    width: 3px;
    cursor: col-resize;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div id="header"&gt;
    header
    &lt;span id="mousestatus"&gt;&lt;/span&gt;
    &lt;span id="clickevent"&gt;&lt;/span&gt;
  &lt;/div&gt;
  &lt;div id="sidebar"&gt;
    &lt;span id="position"&gt;&lt;/span&gt;
    &lt;div id="dragbar"&gt;&lt;/div&gt;
    sidebar
  &lt;/div&gt;
  &lt;div id="main"&gt;
    main
  &lt;/div&gt;
  &lt;div id="footer"&gt;
    footer
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>