Skip to content

Instantly share code, notes, and snippets.

@fabioluzm
Created October 21, 2019 22:02
Show Gist options
  • Save fabioluzm/94498dc3849632de2681f70c1b23016b to your computer and use it in GitHub Desktop.
Save fabioluzm/94498dc3849632de2681f70c1b23016b to your computer and use it in GitHub Desktop.
CSS Transitions
.trigger
.box
$('.trigger').on('click', function(){
$(this).toggleClass('clicked');
});
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
body
padding: 50px
.trigger
width: 200px
height: 200px
border: 20px solid #999
background: #ddd
.box
display: inline-block
background: pink
width: 200px
height: 200px
transition: transform 300ms cubic-bezier(0, 0.47, 0.32, 1.97)
pointer-events: none
.trigger.clicked .box
transform: translate(200px, 150px) rotate(20deg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment