Last active
February 27, 2020 10:58
-
-
Save delvinkrasniqi/ef0b2d5b00f3ae063af8f7b1e166d691 to your computer and use it in GitHub Desktop.
Menu toggler hamburger(X on close)
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
<style> | |
#wrapper{ | |
display: inline-block; | |
position: relative; | |
cursor: pointer; | |
} | |
.circle{ | |
width: 35px; | |
height: 35px; | |
position: relative; | |
} | |
.line{ | |
position: absolute; | |
height: 3px; | |
width: 100%; | |
background: white; | |
border-radius: 8px; | |
transition: all cubic-bezier(0.26, 0.1, 0.27, 1.55 ) 0.35s; | |
} | |
.top{ | |
top: 18%; | |
left: 0; | |
} | |
.middle{ | |
top: 48%; | |
left: 0; | |
} | |
.bottom{ | |
top: 78%; | |
left: 0; | |
} | |
.icon.close .top { | |
transform: rotate(45deg); | |
top: 48%; | |
} | |
.icon.close .middle, .icon.close .bottom{ | |
transform: rotate(-45deg); | |
top: 48%; | |
} | |
.icon.close .line2{ | |
background: red; | |
} | |
</style> | |
/*HTML*/ | |
<div id="wrapper"> | |
<div class="circle icon"> | |
<span class="line top"></span> | |
<span class="line middle"></span> | |
<span class="line bottom"></span> | |
</div> | |
</div> | |
/*end of HTML*/ | |
/*Script - add it to the bottom of the footer right before ending </body>*/ | |
<script> | |
jQuery("#wrapper").click(function(){ | |
jQuery(".icon").toggleClass("close"); | |
}); | |
</script> | |
/*end of script*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment