Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
$(document).ready(function () { $('.icon-menu').click(function (event) { $(this).toggleClass('active'); $('.icon-menu,.menu__body').toggleClass('active'); }); });
$(this).toggleClass('active');
<body> <div class="wrapper"> <main class="page"> <header class="header"> <div class="header__row"> <nav class="header__menu menu"> <div class="header__icon icon__menu"> <span></span> </div> <div class="menu__body"> <ul class="menu__list"> <li> <a href="#" class="menu__link menu__link_first">about us</a> </li> <li> <a href="#" class="menu__link menu__link_1">work</a> </li> <li> <a href="#" class="menu__link menu__link_2">shop</a> </li> <li> <a href="#" class="menu__link menu__link_last">contact</a> </li> </ul> </div> <div class="header__logo"> <img src="img/header/Logo.png" alt=""> </div> </nav> </div> </header> <div class="main-screen"> <div class="main-screen__bg ibg"> <img src="img/main-screen/bg-main.jpg" alt=""> </div> </div> <div class="content"> </div> </main> </div> <script src="source/js/ibg.js"></script> <script src="source/js/click.js"></script> </body> </html>
.header { position: absolute; width: 100%; height: 100%; z-index: 50; left: 0; } .header__row { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; height: 85px; position: relative; top: 35px; } .header__menu { position: absolute; width: 100%; height: 100%; top: 0; left: 0; } .header__logo { position: absolute; top: 0; left: 50%; -webkit-transform: translate(-50%, 0px); -ms-transform: translate(-50%, 0px); transform: translate(-50%, 0px); } @media (max-width: 767px) { .header { top: 0; } .header__row { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .header__logo { top: 15px; z-index: 2; } .header__icon { float: right; position: relative; top: 10px; right: 7px; width: 30px; height: 20px; z-index: 2; } } .menu { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .menu__body { height: inherit; } .menu__list { height: inherit; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; color: #4d4959; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 2.6px; } .menu__link { margin: 37.5px; } .menu__link_1 { margin: 0 110px 0 37.5px; } .menu__link_2 { margin: 0 37.5px 0 110px; } .menu__link_first { margin-left: 0; } .menu__link_last { margin-right: 0; } @media (max-width: 767px) { .menu__body { background-color: #4d4959; position: fixed; top: 0; right: 0; width: 100%; height: 100%; -webkit-transform: translate(-100%, 0); -ms-transform: translate(-100%, 0); transform: translate(-100%, 0); overflow: auto; } .menu__body.active { -webkit-transform: translate(100%, 0); -ms-transform: translate(100%, 0); transform: translate(100%, 0); } .menu__list { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; -webkit-box-align: center; -ms-flex-align: center; align-items: center; position: relative; top: 150px; height: 50%; } .menu__link, .menu li { margin: 0; color: white; font-size: 18px; } .menu li { margin: 0 0 35px 0; } } @media (max-width: 767px) { .icon__menu:before, .icon__menu:after, .icon__menu span { content: ""; position: absolute; left: 0; width: 100%; height: 2px; background-color: white; } .icon__menu:before { top: 0; } .icon__menu:after { bottom: 0; } .icon__menu span { top: 9px; } }