cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div class="chat-box">
  <div class="chat-header">
    <div class="user-profile active" data-up='cont1'></div>
    <span>Erza</span>
    <div class="user-profile" data-up='cont2'></div>
    <span>Nastu</span>
    <div class="user-profile" data-up='cont3'></div>
    <span>Lucy</span>
    <div class="user-profile" data-up='cont4'></div>
    <span>Goku?</span>
  </div>
  <div id='chat' class="chat">

    <div class="chat-container active" id='cont1'>

      <div class="bubble">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ut sapien vitae eros consectetur vehicula lacinia at nibh. Interdum et malesuada fames ac ante ipsum primis in faucibus. Vestibulum aliquet elit nec erat rutrum rutrum. Mauris ligula
          magna, dignissim id tortor eu, aliquet dapibus ipsum</p>
      </div>
      <span class="datestamp">May 20, 2016, 4:16 PM</span>


      <div class="bubble bubble-alt">
        <p>Aenean ac magna rutrum, finibus est at, venenatis ipsum. Etiam egestas venenatis semper. Sed a neque sed sem lacinia finibus ac nec nisi.</p>
      </div>
      <span class="datestamp  dt-alt">May 20, 2016, 4:17 PM</span>


      <div class="bubble">
        <p>Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut facilisis justo in nisl elementum, at fermentum augue tempor. </p>
      </div>

      <div class="bubble">
        <p>Aliquam feugiat tortor ac massa commodo convallis sit amet ultricies urna. Sed pharetra augue ac sapien varius, at vulputate velit pretium.</p>
      </div>
      <span class="datestamp">May 20, 2016, 4:20 PM</span>

      <div class="bubble bubble-alt">
        <p>Quisque sit amet nulla nibh. Mauris eu lacus sed orci rhoncus cursus nec et enim. Phasellus finibus luctus mi ac sodales. Integer efficitur gravida mauris in eleifend. Maecenas ac interdum mi.</p>
      </div>
      <span class="datestamp  dt-alt">May 20, 2016, 4:22 PM</span>
    </div>

    <div class="chat-container" id='cont2'>

      <div class="bubble">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ut sapien vitae eros consectetur vehicula lacinia at nibh. Interdum et malesuada fames ac ante ipsum primis in faucibus. Vestibulum aliquet elit nec erat rutrum rutrum. Mauris ligula
          magna, dignissim id tortor eu, aliquet dapibus ipsum</p>
      </div>
      <span class="datestamp">May 20, 2016, 4:16 PM</span>


      <div class="bubble bubble-alt">
        <p>Aenean ac magna rutrum, finibus est at, venenatis ipsum. Etiam egestas venenatis semper. Sed a neque sed sem lacinia finibus ac nec nisi.</p>
      </div>
      <span class="datestamp  dt-alt">May 20, 2016, 4:17 PM</span>


      <div class="bubble">
        <p>Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut facilisis justo in nisl elementum, at fermentum augue tempor. </p>
      </div>

      <div class="bubble">
        <p>Aliquam feugiat tortor ac massa commodo convallis sit amet ultricies urna. Sed pharetra augue ac sapien varius, at vulputate velit pretium.</p>
      </div>
      <span class="datestamp">May 20, 2016, 4:20 PM</span>

      <div class="bubble bubble-alt">
        <p>Quisque sit amet nulla nibh. Mauris eu lacus sed orci rhoncus cursus nec et enim. Phasellus finibus luctus mi ac sodales. Integer efficitur gravida mauris in eleifend. Maecenas ac interdum mi.</p>
      </div>
      <span class="datestamp  dt-alt">May 20, 2016, 4:22 PM</span>
    </div>
    <div class="chat-container" id='cont3'>
      <div class="bubble">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ut sapien vitae eros consectetur vehicula lacinia at nibh. Interdum et malesuada fames ac ante ipsum primis in faucibus. Vestibulum aliquet elit nec erat rutrum rutrum. Mauris ligula
          magna, dignissim id tortor eu, aliquet dapibus ipsum</p>
      </div>
      <span class="datestamp">May 20, 2016, 4:16 PM</span>


      <div class="bubble bubble-alt">
        <p>Aenean ac magna rutrum, finibus est at, venenatis ipsum. Etiam egestas venenatis semper. Sed a neque sed sem lacinia finibus ac nec nisi.</p>
      </div>
      <span class="datestamp  dt-alt">May 20, 2016, 4:17 PM</span>


      <div class="bubble">
        <p>Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut facilisis justo in nisl elementum, at fermentum augue tempor. </p>
      </div>

      <div class="bubble">
        <p>Aliquam feugiat tortor ac massa commodo convallis sit amet ultricies urna. Sed pharetra augue ac sapien varius, at vulputate velit pretium.</p>
      </div>
      <span class="datestamp">May 20, 2016, 4:20 PM</span>

      <div class="bubble bubble-alt">
        <p>Quisque sit amet nulla nibh. Mauris eu lacus sed orci rhoncus cursus nec et enim. Phasellus finibus luctus mi ac sodales. Integer efficitur gravida mauris in eleifend. Maecenas ac interdum mi.</p>
      </div>
      <span class="datestamp  dt-alt">May 20, 2016, 4:22 PM</span>
    </div>
    <div class="chat-container" id='cont4'>
      <div class="bubble">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ut sapien vitae eros consectetur vehicula lacinia at nibh. Interdum et malesuada fames ac ante ipsum primis in faucibus. Vestibulum aliquet elit nec erat rutrum rutrum. Mauris ligula
          magna, dignissim id tortor eu, aliquet dapibus ipsum</p>
      </div>
      <span class="datestamp">May 20, 2016, 4:16 PM</span>


      <div class="bubble bubble-alt">
        <p>Aenean ac magna rutrum, finibus est at, venenatis ipsum. Etiam egestas venenatis semper. Sed a neque sed sem lacinia finibus ac nec nisi.</p>
      </div>
      <span class="datestamp  dt-alt">May 20, 2016, 4:17 PM</span>


      <div class="bubble">
        <p>Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut facilisis justo in nisl elementum, at fermentum augue tempor. </p>
      </div>

      <div class="bubble">
        <p>Aliquam feugiat tortor ac massa commodo convallis sit amet ultricies urna. Sed pharetra augue ac sapien varius, at vulputate velit pretium.</p>
      </div>
      <span class="datestamp">May 20, 2016, 4:20 PM</span>

      <div class="bubble bubble-alt">
        <p>Quisque sit amet nulla nibh. Mauris eu lacus sed orci rhoncus cursus nec et enim. Phasellus finibus luctus mi ac sodales. Integer efficitur gravida mauris in eleifend. Maecenas ac interdum mi.</p>
      </div>
      <span class="datestamp  dt-alt">May 20, 2016, 4:22 PM</span>
    </div>
  </div>
  <div class="chat-control">
    <input class="chat-input" type="text" placeholder="enter your message" />
  </div>
</div>
            
          
!
            
              * {
  margin: 0;
  padding: 0;
}

body {
  background: #DFDFEF;
  font-family: 'Helvetica Neue';
  font-size: 10px;
  color: #414141;
  font-size: 1.5em;
  line-height: 2em;
}

.chat-box {
  background: linear-gradient(0deg, #1E2C3D 00%, #3E364E 100%);
  margin: 100px auto;
  max-width: 500px;
  height: 650px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
  /*border : 1px solid #000;*/
  overflow: hidden;
  position: relative;
  transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
}

.chat-container {
  position: absolute;
  padding: 20px;
  width: 500px;
  height: 500px;
  overflow: scroll;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
}

.chat-container.active {
  transform: translateX(0);
  transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  opacity: 1;
}

.chat-container.hidechat {
  transform: translateX(-10%);
  transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  opacity: 0;
}

p {
  margin: 0;
}

.bubble {
  float: left;
  width: auto;
  max-width: 80%;
  position: relative;
  clear: both;
  background: #95c2fd;
  padding: 0.5em 1em;
  background: linear-gradient(40deg, rgba(255, 255, 255, 0.2) 00%, rgba(255, 255, 255, 0.3) 100%);
  border-radius: 3px;
  box-shadow: 0 5px 30px rgba(255, 255, 255, 0.1);
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.7);
  word-wrap: break-word;
  font-size: 1em;
  margin-top: 30px;
  opacity: 0;
}

.bubble:after {
  border-radius: 20px / 5px;
  content: '';
  display: block;
  position: absolute;
  border: 8px solid transparent;
  border-bottom-color: rgba(255, 255, 255, 0.2);
  bottom: 1px;
  transform: rotateZ(-90deg);
  left: -15px;
}

.bubble-alt {
  float: right;
}

.bubble-alt:after {
  left: auto;
  border-bottom-color: rgba(255, 255, 255, 0.3);
  transform: rotateZ(90deg);
  right: -16px;
}

.datestamp {
  display: block;
  text-align: center;
  margin-bottom: 30px;
  color: #8b91a0;
  float: left;
  opacity: 0;
}

.dt-alt {
  float: right;
}

.chat-control {
  padding: 1.2em;
  margin-top: 495px;
}

.chat-input {
  width: 100%;
  border: none;
  background: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.3);
  padding: 0.7em;
}

.chat-input:focus {
  border: none;
}

.chat-header {
  background: #fff;
  padding: 0.5em;
  padding-bottom: .7em;
  text-align: center;
}

.chat-header span {
  font-size: 12px;
  position: absolute;
  margin: 47px -50px;
  font-style: italic;
}

.user-profile {
  width: 50px;
  height: 50px;
  display: inline-block;
  border-radius: 100%;
  background: #DFDFEF;
  margin: 0 10px;
  background-size: cover;
  -webkit-filter: grayscale(100%);
  filter: grayscale(100%);
  cursor: pointer
}

.user-profile:nth-child(1) {
  background-image: url(http://vignette3.wikia.nocookie.net/fairytail/images/0/02/Mugshot_of_Erza.png/revision/latest?cb=20130509171537);
}

.user-profile:nth-child(3) {
  background-image: url(http://orig15.deviantart.net/8172/f/2016/079/7/2/natsu_xabused_reader_fire_within_the_heart_p1_by_minnibellsnow-d9vv2cy.jpg);
}

.user-profile:nth-child(5) {
  background-image: url(http://vignette3.wikia.nocookie.net/fairytail/images/e/e7/Lucy_prof_2.jpg/revision/latest?cb=20111024225521);
}

.user-profile:nth-child(7) {
  background-image: url(https://i.ytimg.com/vi/sROSCGZq1rA/hqdefault.jpg);
}

.user-profile.active {
  -webkit-filter: grayscale(0%);
  filter: grayscale(0%);
}
            
          
!
            
                  $(document).ready(function(){
                  $('.user-profile').click(function() {
                      if(!$(this).hasClass('active')){
                          
                          $('.user-profile.active').removeClass('active');
                          $(this).addClass('active');
                          
                          var temp =   $('#'+$(this).attr('data-up'));
                          
                          hideUI('.chat-container')
                          showUI('#'+$(this).attr('data-up'));
                          temp.addClass('active').removeClass('hidechat');
                          temp.prevAll('.chat-container').addClass('hidechat').removeClass('active');
                          temp.nextAll('.chat-container').removeClass('active').removeClass('hidechat');
                      }
                  });
            showUI('#cont1');
        });
        
        function showUI(ele){
            console.log($(ele));
            var kids = $(ele).children(), temp;
            for( var i = kids.length-1 ; i >=0  ; i-- ){
                temp  = $(kids[i]);
                
                if(temp.is('div')){
                    temp.animate({
                        marginTop:0,
                    },400).css({opacity:1}).fadeIn()
                }
                else{
                    temp.css({opacity:1}).fadeIn()
                }   
            }
        }
        
         function hideUI(ele){
            console.log($(ele));
            var kids = $(ele).children(), temp;
            for( var i = kids.length-1 ; i >=0  ; i-- ){
                temp  = $(kids[i]);
                
                if(temp.is('div')){
                    temp.animate({
                        marginTop:'30px',
                    }).css({opacity:0});
                }
                else{
                    temp.css({opacity:0});
                }   
            }
        }
            
          
!
999px
Loading ..................

Console