Skip to content

Instantly share code, notes, and snippets.

@motsu0
Created November 16, 2021 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save motsu0/72287e258a963fe0f70bfb6a52f1049e to your computer and use it in GitHub Desktop.
Save motsu0/72287e258a963fe0f70bfb6a52f1049e to your computer and use it in GitHub Desktop.
<style>
#cont-10{
z-index: 3;
clip-path: polygon(100% 0, 100% 0, 100% 0, 0 100%, 0 100%, 0 100%);
transition: clip-path 1s;
}
#cont-10.moved{
clip-path: polygon(0 0, 100% 0, 100% 100%, 100% 100%, 0 100%, 0 0);
}
</style>
<div id="trans-10" class="cont-outer">
<div class="cont contA">A</div>
<div class="cont contB" id="cont-10">B</div>
</div>
<script>
document.getElementById('trans-10').addEventListener('click',()=>{
document.getElementById('cont-10').classList.toggle('moved');
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment