Created
December 6, 2017 14:50
-
-
Save kharakhordindemo/274c6a0099d345aa3649bc293039fe31 to your computer and use it in GitHub Desktop.
Переключатель крестик
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Переключатель крестик</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<a href="#" class="toggle-menu"><span></span></a> | |
<script src="js/jquery-3.2.1.min.js"></script> | |
<script src="js/script.js"></script> | |
</body> | |
</html> |
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() { | |
$('.toggle-menu').click(function() { | |
$(this).toggleClass('on'); | |
$('.main-menu').slideToggle(); | |
return false; | |
}); | |
});//end ready |
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
/*Toggle-menu(base)*/ | |
.toggle-menu{ | |
display: block; | |
width: 28px; | |
height: 28px; | |
margin-top: 14px; | |
} | |
.toggle-menu span:after, | |
.toggle-menu span:before{ | |
content: ""; | |
position: absolute; | |
left: 0; | |
top: 9px; | |
} | |
.toggle-menu span:after{ | |
top: 18px; | |
} | |
.toggle-menu span{ | |
position: relative; | |
display: block; | |
} | |
.toggle-menu span, | |
.toggle-menu span:after, | |
.toggle-menu span:before{ | |
width: 100%; | |
height: 2px; | |
background-color: #000; | |
transition: all 0.3s; | |
backface-visibility: hidden; | |
border-radius: 2px; | |
} | |
.toggle-menu.on span{ | |
background-color: transparent; | |
} | |
.toggle-menu.on span:before{ | |
transform: rotate(45deg) translate(-1px, 0px); | |
} | |
.toggle-menu.on span:after{ | |
transform: rotate(-45deg) translate(6px, -7px); | |
} | |
.toggle-menu.on + #menu{ | |
opacity: 1; | |
visibility: visible; | |
} | |
/*Toggle-menu(base) End*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment