Всем привет, подскажите почему не хочет срабатывать position: sticky? если вынести в отдельный index и всё работает!
#stick {
position: sticky;
top: 0;
}
// main --------------------
.main__fons {
background-image: url(..//img/main/main.jpg);
background-size: cover;
width: 100vw;
height: 669px;
}
.nav-item {
margin-right: 20px;
}
.navbar-light .navbar-nav .active>.nav-link {
font-family: $Fonst;
font-style: normal;
font-weight: 600;
font-size: 16px;
line-height: 24px;
text-transform: uppercase;
color: $colorText;
&:hover {
color: $hoverHeader;
transition: all 0.4s ease;
}
}
.navbar-light .navbar-nav .nav-link.active {
font-family: $Fonst;
font-style: normal;
font-weight: 600;
font-size: 16px;
line-height: 24px;
text-transform: uppercase;
color: $colorText;
&:hover {
color: $hoverHeader;
transition: all 0.4s ease;
}
}
.navbar {
z-index: 99999;
position: relative;
}
.none__phone {
display: none;
}
.bg__nav {
background: rgba(25, 29, 89, 0.4);
width: 100%;
min-height: 72.59px;
z-index: 99999;
}
.main__btn {
a {
text-decoration: none;
color: $btnColor;
}
}
.dropdown-menu {
margin-top: 20px;
background: rgba(25, 29, 89, 0.9);
padding-left: 0;
a {
font-family: $Fonst;
font-style: normal;
font-weight: 600;
font-size: 15px;
line-height: 24px;
text-transform: uppercase;
color: $colorText;
&:hover {
background: transparent;
color: $hoverHeader;
transition: all 0.4s ease;
}
}
}
<main class="main">
<div class="main__fons">
<div id="stick">
<div class="bg__nav col">
<div class="container">
<div>
<nav class="navbar navbar-expand-lg navbar-light ">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<form class="form-inline header__btn none__phone">
<div class="header__phone">
<div>
<a href="tel:+375232477172">+375 (29) 661-74-32</a>
</div>
<div>
<a href="tel:+375232477172">+375 (232) 47-71-72</a>
</div>
</div>
<!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter" type="submit">Заказать звонок</button> -->
</form>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Главная </a>
</li>
<li class="nav-item active">
<a class="nav-link" href="#">О нас</a>
</li>
<li class="nav-item dropdown active">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Услуги</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="index4.html">Геодезические и картографические работы</a>
<a class="dropdown-item" href="index5.html">Выполнение гидромеханизированных работ </a>
<!-- <div class="dropdown-divider"></div> -->
<a class="dropdown-item" href="#">Диагностирование, монтаж и ремонт</a>
<a class="dropdown-item" href="index3.html"> Аренда и услуги спецтехники</a>
<a class="dropdown-item" href="#">Водопонижение</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link active" href="index6.html">Фотогалерея</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#" tabindex="-1">Задать вопрос</a>
</li>
</ul>
<form class="form-inline header__btn none__phone__media">
<div class="header__phone">
<div>
<a href="tel:+375232477172">+375 (29) 661-74-32</a>
</div>
<div>
<a href="tel:+375232477172">+375 (232) 47-71-72</a>
</div>
</div>
<button type="button" data-toggle="modal" data-target="#exampleModalCenter" type="submit">Заказать звонок</button>
</form>
</div>
</nav>
</div>
</div>
</div>
</div>
</main>