A Pen by Pawel

Thumbnail
This awesome code was written by Szczepkowski, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright Szczepkowski ©
  • HTML
  • CSS
  • JavaScript
    <div class="container">
  <div class="test"></div>
</div>
<button class="first">Opacity</button>
<button class="second">Move</button>
<button class="third">AnimateMove</button>

/*Downloaded from https://www.codeseek.co/Szczepkowski/a-pen-by-pawel-NxrZwR */
    .container {
  position: relative;
  width: 500px;
  height: 400px;
  border: 1px solid black;
}
.test {
  top: 0;
  position: absolute;
  width: 100px;
  height: 100px;
  opacity: 0;
  background-color: blue;
}
.active {
  opacity: 1;
}
.moved {
  top: 50px;
}
.animated {
  transition: all 2s;
}



/*Downloaded from https://www.codeseek.co/Szczepkowski/a-pen-by-pawel-NxrZwR */
    $('.first').on('click', function(){
  $('.test').toggleClass('active');
});
$('.second').on('click', function(){
  $('.test').toggleClass('moved');
});
$('.third').on('click', function(){
  $('.test').toggleClass('animated');
});

Comments