A Pen by takanorioki on CodePen.
Created
December 20, 2016 12:47
-
-
Save takanorip/ead9d7c258d30c2c857bde437c419395 to your computer and use it in GitHub Desktop.
transform: translate3d demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="hoge"></div> | |
<button id="remove" type="button">back</button> | |
<button id="add" type="button">move</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#add').on('click', function(){ | |
$('.hoge').addClass('js-move'); | |
}); | |
$('#remove').on('click', function(){ | |
$('.hoge').removeClass('js-move'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.hoge { | |
width: 60px; | |
height: 60px; | |
background-color: #666; | |
transform: translate3d(0, 0, 0); | |
transition: transform 3s ease ; | |
&.js-move { | |
transform: translate3d(500px, 80px, 0); | |
} | |
} | |
button { | |
width: 80px; | |
height: 40px; | |
margin-top: 16px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment