Created
February 28, 2014 19:43
-
-
Save omniosi/9278323 to your computer and use it in GitHub Desktop.
a CSS-animated menu/close button inspired by http://www.hugeinc.com/
This file contains hidden or 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
*{ | |
-webkit-transition: opacity 100ms ease; | |
transition: opacity 100ms ease; | |
-webkit-transition: all 500ms ease; | |
transition: all 500ms ease; | |
} | |
#box{ | |
background:lightgrey; | |
width:60px; | |
height:60px; | |
} | |
ul{ | |
padding:15px; | |
} | |
li{ | |
list-style:none; | |
width:100%; | |
height:6px; | |
background:#000; | |
margin-bottom:6px; | |
position:relative; | |
} | |
li:first-child{ | |
-webkit-transform:rotate(0deg); | |
transform:rotate(0deg); | |
top:0px; | |
} | |
li:last-child{ | |
-webkit-transform:rotate(0deg); | |
transform:rotate(0deg); | |
top:0px; | |
} | |
.open li{ | |
opacity:0; | |
} | |
.open li:first-child{ | |
-webkit-transform:rotate(45deg); | |
transform:rotate(45deg); | |
top:12px; | |
opacity:1; | |
} | |
.open li:last-child{ | |
-webkit-transform:rotate(-45deg); | |
transform:rotate(-45deg); | |
top:-12px; | |
opacity:1; | |
} |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div id="box"> | |
<ul> | |
<li></li> | |
<li></li> | |
<li></li> | |
</ul> | |
</div> | |
</body> | |
</html> |
This file contains hidden or 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
$(document).ready(function(){ | |
$('ul').on('click',function(){ | |
$('ul').toggleClass('open'); | |
}); | |
}); |
AleksyukAleksander
commented
Feb 22, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment