Last active
August 29, 2015 14:05
-
-
Save valerysntx/53f1fd3d8f00d1cb3bed to your computer and use it in GitHub Desktop.
animated mobile button - http://codepen.io/d_kim/pen/mBfeL
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
.box | |
.btn |
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
$(document).ready(function() { | |
$('.box').click(function() { | |
$(this).toggleClass('active'); | |
}); | |
}); | |
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
.box { | |
width: 50px; | |
height: 50px; | |
margin: 3em auto; | |
background: #eee; | |
border-radius: .4em; | |
cursor: pointer; | |
transition: all .3s ease; | |
&:hover { | |
background: lighten(#eee, 5%); | |
} | |
} | |
.btn, .btn:before, .btn:after { | |
width: 6px; | |
height: 6px; | |
border-radius: 50%; | |
background: #555; | |
transition: all .3s ease; | |
} | |
.btn { | |
margin: 0 auto; | |
position: relative; | |
top: 22px; | |
&:before, &:after { | |
content: ''; | |
position: absolute; | |
} | |
&:before { | |
left: -12px; | |
} | |
&:after { | |
left: 12px; | |
} | |
} | |
.box.active { | |
.btn, .btn:before, .btn:after { | |
height: 30px; | |
border-radius: 3px; | |
} | |
.btn { | |
transform: translateY(-11px); | |
background: transparent; | |
} | |
.btn:before { | |
transform: translateX(12px) rotate(225deg); | |
} | |
.btn:after { | |
transform: translateX(-12px) rotate(-225deg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment