title: Adding sidebar chat to bootstrap 3?
body: <p>I am trying to make sidebar chat for boostrap 3, something like this</p>
  
  <p><img src="https://i.stack.imgur.com/V0qhC.png" alt="enter image description here"></p>
  
  <p>To be always at the right, and when click to be opened from right to left, </p>
  
  <p><img src="https://i.stack.imgur.com/lvEP8.jpg" alt="enter image description here"></p>
  
  <p>And when user clikc to be opened, i dont need the styling i can modified the css later, only needed functionality</p>
  
  <p>Can someone just help me for basic funcionality?</p>
  
  <p>This is what i have for now</p>
  
  <pre><code>  &lt;div class="row chat-window col-xs-5 col-md-3" id="chat_window_1" style="margin-left:10px;"&gt;
    &lt;i id="chat-open" class="fa fa-camera-retro fa-2x"&gt;&lt;/i&gt;
          &lt;div class="col-xs-11 col-md-11 pull-right"&gt;
              &lt;div class="panel panel-default"&gt;
                  &lt;div class="panel-heading top-bar"&gt;
                      &lt;div class="col-md-8 col-xs-8"&gt;
                          &lt;h3 class="panel-title"&gt;&lt;span class="glyphicon glyphicon-comment"&gt;&lt;/span&gt; Chat - Miguel&lt;/h3&gt;
                      &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;div class="panel-body msg_container_base"&gt;
                      &lt;div class="row msg_container base_sent"&gt;
                          &lt;div class="col-md-10 col-xs-10"&gt;
                              &lt;div class="messages msg_sent"&gt;
                                  &lt;p&gt;that mongodb thing looks good, huh?
                                  tiny master db, and huge document store&lt;/p&gt;
                                  &lt;time datetime="2009-11-13T20:00"&gt;Timothy • 51 min&lt;/time&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="col-md-2 col-xs-2 avatar"&gt;
                              &lt;img src="http://www.bitrebels.com/wp-content/uploads/2011/02/Original-Facebook-Geek-Profile-Avatar-1.jpg" class=" img-responsive "&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="row msg_container base_receive"&gt;
                          &lt;div class="col-md-2 col-xs-2 avatar"&gt;
                              &lt;img src="http://www.bitrebels.com/wp-content/uploads/2011/02/Original-Facebook-Geek-Profile-Avatar-1.jpg" class=" img-responsive "&gt;
                          &lt;/div&gt;
                          &lt;div class="col-md-10 col-xs-10"&gt;
                              &lt;div class="messages msg_receive"&gt;
                                  &lt;p&gt;that mongodb thing looks good, huh?
                                  tiny master db, and huge document store&lt;/p&gt;
                                  &lt;time datetime="2009-11-13T20:00"&gt;Timothy • 51 min&lt;/time&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="row msg_container base_receive"&gt;
                          &lt;div class="col-md-2 col-xs-2 avatar"&gt;
                              &lt;img src="http://www.bitrebels.com/wp-content/uploads/2011/02/Original-Facebook-Geek-Profile-Avatar-1.jpg" class=" img-responsive "&gt;
                          &lt;/div&gt;
                          &lt;div class="col-xs-10 col-md-10"&gt;
                              &lt;div class="messages msg_receive"&gt;
                                  &lt;p&gt;that mongodb thing looks good, huh?
                                  tiny master db, and huge document store&lt;/p&gt;
                                  &lt;time datetime="2009-11-13T20:00"&gt;Timothy • 51 min&lt;/time&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="row msg_container base_sent"&gt;
                          &lt;div class="col-xs-10 col-md-10"&gt;
                              &lt;div class="messages msg_sent"&gt;
                                  &lt;p&gt;that mongodb thing looks good, huh?
                                  tiny master db, and huge document store&lt;/p&gt;
                                  &lt;time datetime="2009-11-13T20:00"&gt;Timothy • 51 min&lt;/time&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="col-md-2 col-xs-2 avatar"&gt;
                              &lt;img src="http://www.bitrebels.com/wp-content/uploads/2011/02/Original-Facebook-Geek-Profile-Avatar-1.jpg" class=" img-responsive "&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="row msg_container base_receive"&gt;
                          &lt;div class="col-md-2 col-xs-2 avatar"&gt;
                              &lt;img src="http://www.bitrebels.com/wp-content/uploads/2011/02/Original-Facebook-Geek-Profile-Avatar-1.jpg" class=" img-responsive "&gt;
                          &lt;/div&gt;
                          &lt;div class="col-xs-10 col-md-10"&gt;
                              &lt;div class="messages msg_receive"&gt;
                                  &lt;p&gt;that mongodb thing looks good, huh?
                                  tiny master db, and huge document store&lt;/p&gt;
                                  &lt;time datetime="2009-11-13T20:00"&gt;Timothy • 51 min&lt;/time&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="row msg_container base_sent"&gt;
                          &lt;div class="col-md-10 col-xs-10 "&gt;
                              &lt;div class="messages msg_sent"&gt;
                                  &lt;p&gt;that mongodb thing looks good, huh?
                                  tiny master db, and huge document store&lt;/p&gt;
                                  &lt;time datetime="2009-11-13T20:00"&gt;Timothy • 51 min&lt;/time&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="col-md-2 col-xs-2 avatar"&gt;
                              &lt;img src="http://www.bitrebels.com/wp-content/uploads/2011/02/Original-Facebook-Geek-Profile-Avatar-1.jpg" class=" img-responsive "&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="panel-footer"&gt;
                      &lt;div class="input-group"&gt;
                          &lt;input id="btn-input" type="text" class="form-control input-sm chat_input" placeholder="Write your message here..." /&gt;
                          &lt;span class="input-group-btn"&gt;
                          &lt;button class="btn btn-primary btn-sm" id="btn-chat"&gt;Send&lt;/button&gt;
                          &lt;/span&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p><strong>CSS</strong></p>
  
  <pre><code>.panel{
      margin-bottom: 0px;
  }
  .chat-window{
      top:300px;
      position:fixed;
      float:right;
      margin-left:10px;
      right: -417px;
  }
  .chat-window &gt; div &gt; .panel{
      border-radius: 5px 5px 0 0;
  }
  .icon_minim{
      padding:2px 10px;
  }
  .msg_container_base{
    background: #e5e5e5;
    margin: 0;
    padding: 0 10px 10px;
    max-height:300px;
    overflow-x:hidden;
  }
  .top-bar {
    background: #666;
    color: white;
    padding: 10px;
    position: relative;
    overflow: hidden;
  }
  .msg_receive{
      padding-left:0;
      margin-left:0;
  }
  .msg_sent{
      padding-bottom:20px !important;
      margin-right:0;
  }
  .messages {
    background: white;
    padding: 10px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    max-width:100%;
  }
  .messages &gt; p {
      font-size: 13px;
      margin: 0 0 0.2rem 0;
    }
  .messages &gt; time {
      font-size: 11px;
      color: #ccc;
  }
  .msg_container {
      padding: 10px;
      overflow: hidden;
      display: flex;
  }
  img {
      display: block;
      width: 100%;
  }
  .avatar {
      position: relative;
  }
  .base_receive &gt; .avatar:after {
      content: "";
      position: absolute;
      top: 0;
      right: 0;
      width: 0;
      height: 0;
      border: 5px solid #FFF;
      border-left-color: rgba(0, 0, 0, 0);
      border-bottom-color: rgba(0, 0, 0, 0);
  }
  
  .base_sent {
    justify-content: flex-end;
    align-items: flex-end;
  }
  .base_sent &gt; .avatar:after {
      content: "";
      position: absolute;
      bottom: 0;
      left: 0;
      width: 0;
      height: 0;
      border: 5px solid white;
      border-right-color: transparent;
      border-top-color: transparent;
      box-shadow: 1px 1px 2px rgba(black, 0.2); // not quite perfect but close
  }
  
  .msg_sent &gt; time{
      float: right;
  }
  
  
  
  .msg_container_base::-webkit-scrollbar-track
  {
      -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
      background-color: #F5F5F5;
  }
  
  .msg_container_base::-webkit-scrollbar
  {
      width: 12px;
      background-color: #F5F5F5;
  }
  
  .msg_container_base::-webkit-scrollbar-thumb
  {
      -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
      background-color: #555;
  }
  
  .visible{
    right:0px !important;
  }
  </code></pre>
  
  <p>What i need is to hide chat on right, and when click on icon to chat show, and again on icon to hide?</p>
  
  <p>Here is 
  JS</p>
  
  <pre><code>$( "#chat-open" ).click(function() {
  $('#chat_window_1').toggleClass('visible');
  });
  </code></pre>
  
  <p>The problem is that thsi way chat only pop up, is it possible to add sime nice slide animation from right to left?</p>
  
  <p>Here is working bootply
  <a href="http://www.bootply.com/ZTdXhZGi1d" rel="nofollow noreferrer">http://www.bootply.com/ZTdXhZGi1d</a></p>
  
  <p><strong>SOLUTION</strong></p>
  
  <pre><code>$("#chat-open").click(function() {
    if ($('#chat_window_1').css('right') == "0px") {
      $('#chat_window_1').animate({right: "-417px"}, 1200);
    } else {
      $('#chat_window_1').animate({right: "0px"}, 1200);
    }
  });
  </code></pre>