JSFiddle - React, Tailwind, and code Playground

by Rishabh Sharma

HTML

<div id="peek">Here I am</div>

CSS

html, body {
  height : 100%;
  width  : 100%;
  overflow-x: hidden;
}
#peek {
  height : 100%;
  width  : 400px;
  float  : right;
  position : relative;
  left:360px;
  background-color : pink;
}

JavaScript

$('#peek').on('click', function(){
  var $this = $(this);
  if ($this.hasClass('open')) {
    $this.animate({
      left : '360px'
    }, 500).removeClass('open');
  } else {
    $this.animate({
      left : 0
    }, 500).addClass('open');
  }
});