Skip to content

Instantly share code, notes, and snippets.

@takanorip
Created December 20, 2016 12:47
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 takanorip/ead9d7c258d30c2c857bde437c419395 to your computer and use it in GitHub Desktop.
Save takanorip/ead9d7c258d30c2c857bde437c419395 to your computer and use it in GitHub Desktop.
transform: translate3d demo
<div class="hoge"></div>
<button id="remove" type="button">back</button>
<button id="add" type="button">move</button>
$('#add').on('click', function(){
$('.hoge').addClass('js-move');
});
$('#remove').on('click', function(){
$('.hoge').removeClass('js-move');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
.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