sparkles2.png

Mega Menu - Side Border on Hover

 

This effect will add a border to each side of your Mega Menu Item. This can be seen as a hover but can also be made to stay static (visible) solely on the page you are on to highlight where you are.

 
 
 

See the effect in action

 
Screenshot 2021-07-08 at 16.31.54.png
 
 
 

How to use the Effect

The below code will apply the hover effect. To make the effect stay static (visible) on the current page you are on then please scroll further to see the additional lines.

Select 'Options' from the top header of BlockLab and then select 'Advanced > Custom CSS'. Copy and paste the below code. Hit save, go to Blocklab and Publish and the effect will be applied.

 

CSS

#shop [id^=mega-menu-v2] li a:hover span {
    display: none;
}
#shop [id^=mega-menu-v2] li a:hover:before {
    content: "
(";
}
#shop [id^=mega-menu-v2] li a:hover:after {
    content: "
)";
}

(To edit the content either side of the Mega Menu hover, change the Red code) 

For keeping the border static (visible) for the current page:

CSS

#shop .homepage #blocklab-header #mega-menu-v2_1595237452402 .navbar-nav li:nth-of-type(2) a:before {content:"(" !important;}
#shop .homepage #blocklab-header #mega-menu-v2_
1595237452402 .navbar-nav li:nth-of-type(2) a:after {content:")" !important;}

(Replace the Blue code with your own Mega Menu ID - Find it using this tutorial) FIND MEGA MENU ID

(To edit the content either side of the Mega Menu hover, change the Red code) 


You need to replicate this code for each menu item you have. This code is for the first menu item. You will need to replicate this for each menu item you have. For each page you will need to increase the Green bit of code by 1.
For example, if you have 5 pages on the Mega Menu, it will look like this:

#shop .homepage #blocklab-header #mega-menu-v2_1595237452402 .navbar-nav li:nth-of-type(2) a:before {
    content: "(" !important;
}
#shop .homepage #blocklab-header #mega-menu-v2_1595237452402 .navbar-nav li:nth-of-type(2) a:after {
    content: ")" !important;
}
#shop .pagesabout #blocklab-header #mega-menu-v2_1595237452402 .navbar-nav li:nth-of-type(3) a:before {
    content: "(" !important;
}
#shop .pagesabout #blocklab-header #mega-menu-v2_1595237452402 .navbar-nav li:nth-of-type(3) a:after {
    content: ")" !important;
}
#shop .pagesservices #blocklab-header #mega-menu-v2_1595237452402 .navbar-nav li:nth-of-type(4) a:before {
    content: "(" !important;
}
#shop .pagesservices #blocklab-header #mega-menu-v2_1595237452402 .navbar-nav li:nth-of-type(4) a:after {
    content: ")" !important;
}
#shop .pagestestinspection #blocklab-header #mega-menu-v2_1595237452402 .navbar-nav li:nth-of-type(5) a:before {
    content: "(" !important;
}
#shop .pagestestinspection #blocklab-header #mega-menu-v2_1595237452402 .navbar-nav li:nth-of-type(5) a:after {
    content: ")" !important;
}
#shop .pagescontact #blocklab-header #mega-menu-v2_1595237452402 .navbar-nav li:nth-of-type(6) a:before {
    content: "(" !important;
}
#shop .pagescontact #blocklab-header #mega-menu-v2_1595237452402 .navbar-nav li:nth-of-type(6) a:after {
    content: ")" !important;
}