2

Доброго времени суток!

Собственно вопрос в заголовке. Открываем меню => наводим на 1 элемент => background перекрывает другие элементы. Хз что поделать, уже пол дня бьюсь. Товарищи выручайте пожалуйста. Строка 176 в CSS.

/*Кнопка меню*/
/*	@media screen and (min-width: 614px) {
		.btn_menu {
		   display: none;
	   }
	}	*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

html { overflow-x: hidden; }

@media (min-width: 768px) {
.nav_menu {
    width: 75px;
    height: 100%;
	}
}

.nav_menu {	
	width: 100%;
    height: 70px;
	top: 0;
    background-color: #FFF;
    position: relative;
    z-index: 99999;
    box-shadow: 0 2px 30px 0 rgba(0, 0, 0, 0.1);
}

.btn_menu * {
    transition: all 0.3s;
    -webkit-transition: all 0.3s;
    box-sizing: border-box;
	cursor: pointer;
}

.btn_menu {
    position: absolute;
	top: 20px;
	left: 25px;
    height: 35px;
    width: 50px;
}

.btn_menu input[type=checkbox] {
    display: none;
}

.btn_menu label {
    cursor: pointer;
    position: absolute;
    z-index: 99;
    height: 100%;
    width: 100%;
}

.btn_menu .btn_menu_img {
    position: absolute;
    height: 5px;
    width: 100%;
    background-color: #333;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1);
	border-radius: 10px;
}

.btn_menu .diagonal.part-1 {
    position: relative;
    float: left;
}

.btn_menu .horizontal {
    position: relative;
    float: left;
    margin-top: 6px;
}

.btn_menu .diagonal.part-2 {
    position: relative;
    float: left;
    margin-top: 6px;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .horizontal {
    transform: translate(-100px, 0px);
    opacity: 0;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .diagonal.part-1 {
    transform: rotate(-135deg);
    margin-top: 10px;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .diagonal.part-2 {
    transform: rotate(135deg);
    -webkit-transform: rotate(135deg);
    margin-top: -16px;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu {
	transition: all .4s cubic-bezier(0.4, -0.4, 0.2, 0.2);
	width: 100vw;
	height: 100vh;
	display: block;
	background-color: black;
	position: absolute;
	top: 50px;
	left: -25px;
	border-radius: 0;
}

.box_menu {
	transition: ease .4s;
	transition-delay: 1.4s;
	border-radius: 0;
	cursor: default;
	position: absolute;
	top: 50px;
	left: -25px;
	width: 0;
	height: 0;
	
}

.btn_menu_img_on > .box_menu > li {
	cursor: default;
	list-style-type: none;
	text-align: center;
	margin: 20px;
	transition: ease 0.6s;
	font-size: 0;
}

.btn_menu_img_on > .box_menu > li > a {
	color: #9e8989;
	text-decoration: none;
	z-index: 1000;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li > a {
	color: #9e8989;
	text-decoration: none;
	z-index: 1000;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li > a:hover {
	color: #fff;
	z-index: 1000;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li:nth-child(1) {
	font-size: 36px;
	transition: .6s;
	color: #ffffff;
}

.btn_menu_img_on > .box_menu > li:nth-child(1) {
	font-size: 0px;
	transition: 1s;
}

body > div > div > label > ul > li > div {
	z-index: 0;
	opacity: 0;
	transition: .5s;
}

body > div > div > label > ul > li > a {
	z-index: 1000;
}

body > div > div > label > ul > li:nth-child(1) > a:hover > div {
	position: absolute;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: url(https://www.canvaspop.com/v2/images/2016/office/fuel-space-large.jpg) 100% 100% no-repeat;
	background-size: contain;
	z-index: 1;
	opacity: 0.2;
	transition: .5s;
	background-color: transparent;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li:nth-child(2) {
	font-size: 36px;
	transition: .8s;
}

.btn_menu_img_on > .box_menu > li:nth-child(2) {
	font-size: 0px;
	transition: .8s;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li:nth-child(3) {
	font-size: 36px;
	transition: 1s;
}

.btn_menu_img_on > .box_menu > li:nth-child(3) {
	font-size: 0px;
	transition: .6s;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li:nth-child(4) {
	font-size: 36px;
	transition: 1.2s;
}

.btn_menu_img_on > .box_menu > li:nth-child(4) {
	font-size: 0px;
	transition: .4s;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li:nth-child(5) {
	font-size: 36px;
	transition: 1.4s;
}

.btn_menu_img_on > .box_menu > li:nth-child(5) {
	font-size: 0px;
	transition: .2s;
}
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="main.css">

<body>
	<div class="nav_menu">
		<div class="btn_menu">
			<input type="checkbox" id="spinner-form4" />
			<label for="spinner-form4" class="btn_menu_img_on">
				<div class="btn_menu_img diagonal part-1"></div>
				<div class="btn_menu_img horizontal"></div>
				<div class="btn_menu_img diagonal part-2"></div>
					<ul class="box_menu">
						<li><a href="#">Текст1<div></div></a></li>
						<li><a href="#">Текст1Текст12</a></li>
						<li><a href="#">Текст1Текст1Текст13</a></li>
						<li><a href="#">Текст1Текст1Текст1Текст14</a></li>
						<li><a href="#">Текст1Текст1Текст1Текст1Текст15</a></li>
					</ul>
			</label>
		</div>
	</div>
</body>		

1
  • 1
    Обьясните, какой результат вам нужен? Если так, что бы фон был скрыт, так не используйте его. Если поправить анимацию, то есть ответ от @Nsk.
    – E_K
    28 ноя 2018 в 17:49

1 ответ 1

3

Надо так? В правильности решения не очень уверен.

/*Кнопка меню*/
/*	@media screen and (min-width: 614px) {
		.btn_menu {
		   display: none;
	   }
	}	*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

html { overflow-x: hidden; }

@media (min-width: 768px) {
.nav_menu {
    width: 75px;
    height: 100%;
	}
}

.nav_menu {	
	width: 100%;
    height: 70px;
	top: 0;
    background-color: #FFF;
    position: relative;
    z-index: 99999;
    box-shadow: 0 2px 30px 0 rgba(0, 0, 0, 0.1);
}

.btn_menu * {
    transition: all 0.3s;
    -webkit-transition: all 0.3s;
    box-sizing: border-box;
	cursor: pointer;
}

.btn_menu {
    position: absolute;
	top: 20px;
	left: 25px;
    height: 35px;
    width: 50px;
}

.btn_menu input[type=checkbox] {
    display: none;
}

.btn_menu label {
    cursor: pointer;
    position: absolute;
    z-index: 99;
    height: 100%;
    width: 100%;
}

.btn_menu .btn_menu_img {
    position: absolute;
    height: 5px;
    width: 100%;
    background-color: #333;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1);
	border-radius: 10px;
}

.btn_menu .diagonal.part-1 {
    position: relative;
    float: left;
}

.btn_menu .horizontal {
    position: relative;
    float: left;
    margin-top: 6px;
}

.btn_menu .diagonal.part-2 {
    position: relative;
    float: left;
    margin-top: 6px;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .horizontal {
    transform: translate(-100px, 0px);
    opacity: 0;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .diagonal.part-1 {
    transform: rotate(-135deg);
    margin-top: 10px;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .diagonal.part-2 {
    transform: rotate(135deg);
    -webkit-transform: rotate(135deg);
    margin-top: -16px;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu {
	transition: all .4s cubic-bezier(0.4, -0.4, 0.2, 0.2);
	width: 100vw;
	height: 100vh;
	display: block;
	background-color: black;
	position: absolute;
	top: 50px;
	left: -25px;
	border-radius: 0;
}

.box_menu {
	transition: ease .4s;
	transition-delay: 1.4s;
	border-radius: 0;
	cursor: default;
	position: absolute;
	top: 50px;
	left: -25px;
	width: 0;
	height: 0;
	
}

.btn_menu_img_on > .box_menu > li {
	cursor: default;
	list-style-type: none;
	text-align: center;
	margin: 20px;
	transition: ease 0.6s;
	font-size: 0;
}

.btn_menu_img_on > .box_menu > li > a {
	color: #9e8989;
	text-decoration: none;
	z-index: 1000;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li > a {
	color: #9e8989;
	text-decoration: none;
	z-index: 1000;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li > a:hover {
	color: #fff;
	z-index: 1000;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li:nth-child(1) {
	font-size: 36px;
	transition: .6s;
	color: #ffffff;
}

.btn_menu_img_on > .box_menu > li:nth-child(1) {
	font-size: 0px;
	transition: 1s;
}

body > div > div > label > ul > li > div {
	z-index: 0;
	opacity: 0;
	transition: .5s;
}

body > div > div > label > ul > li > a {
	z-index: 1000;
  position: relative;
}

body > div > div > label > ul > li:nth-child(1) > a:hover ~ div {
	position: absolute;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: url(https://www.canvaspop.com/v2/images/2016/office/fuel-space-large.jpg) 100% 100% no-repeat;
	background-size: contain;
	z-index: 1;
	opacity: 0.2;
	transition: .5s;
	background-color: transparent;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li:nth-child(2) {
	font-size: 36px;
	transition: .8s;
}

.btn_menu_img_on > .box_menu > li:nth-child(2) {
	font-size: 0px;
	transition: .8s;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li:nth-child(3) {
	font-size: 36px;
	transition: 1s;
}

.btn_menu_img_on > .box_menu > li:nth-child(3) {
	font-size: 0px;
	transition: .6s;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li:nth-child(4) {
	font-size: 36px;
	transition: 1.2s;
}

.btn_menu_img_on > .box_menu > li:nth-child(4) {
	font-size: 0px;
	transition: .4s;
}

.btn_menu input[type=checkbox]:checked ~ .btn_menu_img_on > .box_menu > li:nth-child(5) {
	font-size: 36px;
	transition: 1.4s;
}

.btn_menu_img_on > .box_menu > li:nth-child(5) {
	font-size: 0px;
	transition: .2s;
}
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="main.css">

<body>
	<div class="nav_menu">
		<div class="btn_menu">
			<input type="checkbox" id="spinner-form4" />
			<label for="spinner-form4" class="btn_menu_img_on">
				<div class="btn_menu_img diagonal part-1"></div>
				<div class="btn_menu_img horizontal"></div>
				<div class="btn_menu_img diagonal part-2"></div>
					<ul class="box_menu">
						<li><a href="#">Текст1</a><div></div></li>
						<li><a href="#">Текст1Текст12</a></li>
						<li><a href="#">Текст1Текст1Текст13</a></li>
						<li><a href="#">Текст1Текст1Текст1Текст14</a></li>
						<li><a href="#">Текст1Текст1Текст1Текст1Текст15</a></li>
					</ul>
			</label>
		</div>
	</div>
</body>

1
  • Спасибо большое! Это то, что нужно :) 29 ноя 2018 в 6:40

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.