Skip to content

Instantly share code, notes, and snippets.

@inakagawa
Last active November 18, 2015 08:16
Show Gist options
  • Save inakagawa/3a335cecfa3971d97087 to your computer and use it in GitHub Desktop.
Save inakagawa/3a335cecfa3971d97087 to your computer and use it in GitHub Desktop.
learning animation css / drawer menu

これはなにか

クリックすると引き出されるドロワー

/*cssanim.css*/
#drawer{
width: 350px;
height: 100%;
color: white;
left: -350px;
overflow: auto;
position: fixed;
background: #333;
transition: -webkit-transform 0.3s ease-out;
transition: transform 0.3s ease-out;
}
.move {
-webkit-transform: translate3d(350px, 0, 0);
transform: translate3d(350px, 0, 0);
}
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>css animation</title>
<link rel="stylesheet" href="cssanim.css">
</head>
<body>
<div id="drawer">
<ul>
<li>a</li>
<li>b</li>
<li>c</li>
</ul>
</div>
<div class="invoker">
click here to invoke
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script>
$('.invoker').on('click', function(){
$('#drawer').addClass('move');
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment