Site logo

Archived topic

Separate menu css for sticky menu

3 replies · Started by Harris on April 27, 2020

Viewing posts 1–4 of 4

Hello,

I got this code using it in several sites altered, in order to underline active and hovered menu items in site's primary navigation

/* Menu underlining */

@media (min-width: 767px) {

.main-navigation .menu > .menu-item > a::after {
    content: "";
	position: relative;
	top: -35px;
	opacity: 1;
    display: block;
    width: 0;
    border-bottom: 6px solid #ff8c3d;
    background-color: currentColor;
    transition: 0.3s width ease;
}
.main-navigation .menu > .menu-item.current-menu-item > a::after,
.main-navigation .menu > .menu-item > a:hover::after {
    width: 50%;
}

Is there some was I can exclude the sticky navigation from that underlining? (underline applies in site navigation but not in sticky navigation)

Thanks
Harris

Hi there,

your first line of CSS - chage it to:

.main-navigation:not(.is_stuck) .menu > .menu-item > a::after {

Thanks David!

You're welcome

This archived topic is closed to new replies.