Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save VasylKyryliuk/7a8a8f5052403061569f830a05325dd6 to your computer and use it in GitHub Desktop.
Save VasylKyryliuk/7a8a8f5052403061569f830a05325dd6 to your computer and use it in GitHub Desktop.
Скролл горизонтального меню
<div class="nav">
<nav class="cvu-navigation">
<ul class="navigation">
<li class="active"><a href="#">Послуги</a></li>
<li><a href="#">Акції</a></li>
<li><a href="#">Галерея</a></li>
<li><a href="#">Жалюзі та ролети</a></li>
<li><a href="#">Натяжні стелі</a></li>
<li><a href="#">Ковані вироби</a></li>
<li><a href="#">Статті</a></li>
<li><a href="#">Контакти</a></li>
</ul>
</nav>
</div>
-----------============= css =============-----------
.nav{
box-shadow: 0 1px 20px 8px rgba(0,0,0,0.25);
position: relative;
z-index: 2;
width: 100%;
background-color: #131417 !important;
}
.cvu-navigation{
height: 48px;
display: block;
text-align: center;
font-size: 0;
position: relative;
padding: 0;
margin: 0 auto;
user-select: none;
max-width: 1260px;
}
.cvu-navigation li{
display: inline-block;
font-size: 16px;
text-align: center;
line-height: 46px;
text-transform: uppercase;
position: relative;
overflow: hidden;
cursor: pointer;
margin: 0 12px;
min-width: 100px;
max-width: 264px;
border-bottom: 2px solid transparent;
transition: all 0.5s;
}
.cvu-navigation li.active{
border-bottom-color: #ffd741;
}
.cvu-navigation li:first-child{
margin-left: 0;
}
.cvu-navigation li:last-child{
margin-right: 0;
}
.cvu-navigation li a{
*font-weight: 300;
letter-spacing: -0.4px;
color: rgba(255, 255, 255, 0.5);
text-decoration: none;
}
.cvu-navigation li.active a{
color: #fff;
}
.navigation{
margin: 0;
padding: 0;
}
.ripple {
width: 0;
height: 0;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
-webkit-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
position: absolute;
opacity: 1;
}
.rippleEffect {
-webkit-animation: rippleDrop .6s linear;
animation: rippleDrop .6s linear;
}
@-webkit-keyframes rippleDrop {
100% {
-webkit-transform: scale(2);
transform: scale(2);
opacity: 0;
}
}
@keyframes rippleDrop {
100% {
-webkit-transform: scale(2);
transform: scale(2);
opacity: 0;
}
}
@media (max-width: 1480px) {
.cvu-navigation li{
min-width: 72px;
}
}
@media (min-width: 1000px) {
.cvu-navigation {
background-color: #131417 !important;
height: 56px;
line-height: 56px;
}
.cvu-navigation li{
line-height: 53px;
border-bottom: 3px solid transparent;
}
}
@media (max-width: 980px) {
.cvu-navigation li{
margin: 0 6px;
}
.cvu-navigation li:first-child{
margin-left: 0;
}
}
@media (max-width: 865px){
.cvu-navigation{
overflow: auto;
-webkit-overflow-scrolling: touch;
max-width: 960px;
height: 57px;
}
.nav{
display: inline-block;
width: 100%;
height: 48px;
overflow: hidden;
box-shadow: 0 1px 7px -2px rgba(0,0,0,0.8);
position: relative;
}
/*
.cvu-navigation:after {
content: "";
display: inline-block;
position: absolute;
width: 100%;
background: #fff;
height: 5px;
bottom: 0;
left: 0;
}
*/
.nav::after {
content: "";
display: table;
position: absolute;
top: 0;
right: 0;
height: 48px;
width: 50px;
z-index: 1;
pointer-events: none;
visibility: visible;
opacity: 1;
-webkit-transition: opacity .3s 0s, visibility 0s 0s;
-moz-transition: opacity .3s 0s, visibility 0s 0s;
transition: opacity .3s 0s, visibility 0s 0s;
background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.39) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(100%, rgba(255,255,255,0.39)));
background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.39) 100%);
background: -o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.39) 100%);
background: -ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.39) 100%);
background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.39) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ffffff', GradientType=1 );
}
.navigation{
padding: 0 10px;
width: 835px;
height: 48px;
overflow: hidden;
}
.navigation:after {
content: "";
display: table;
clear: both;
}
.navigation li {
float: left;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment