We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Mega menu fade in/out

Mega menu fade in/out

Ravenwoodstore
Excursionist
16 0 7

Hi guys,

 

store: ravenwood.store

pass: moths

 

I'm looking to add a fade in/out transition to the mega menu, so that when you hover over it, it opens up with a fade, then when you leave it, it fades back out, instead of being instantaneous. 

 

I've tried to add this code:

 

.mega-menu {

opacity: 0;

transition: opacity 0.3s ease;

}

.mega-menu:hover {

opacity: 1;

}

 

But this hides the links in the mega menu until you hover over it. (The fade works however!) 

 

How can I have this fade effect, but also have my menu buttons visible at all times?

 

 

Without code: buttons are visible at all times:

Ravenwoodstore_1-1750168292160.png

 

With code: missing buttons:

Ravenwoodstore_0-1750168259750.png

 

 

Thanks!

Replies 4 (4)

websensepro
Shopify Partner
2144 268 321

Hi @Ravenwoodstore , kindly provide your store URL please and if it is password protected, please share the password as well. Thanks

Need a Shopify developer? Hire us at WebSensePro For Shopify Design Changes/Coding
For Free Tutorials Subscribe to our youtube
Get More Sales Using Big Bulk Discount APP
Create Your Shopify Store For Just 1$/Month
Get More Sales Using Big Bulk Discount APP
Ravenwoodstore
Excursionist
16 0 7

Hi  @websensepro ,

 

store: ravenwood.store

pass: moths

Thanks

topnewyork
Astronaut
1552 192 253

Hello @Ravenwoodstore ,

You're close! The issue with your current approach is that you're applying the opacity: 0 directly to .mega-menu, which hides the entire menu (including the container that should become visible on hover), not just animating it in and out.

Try this code
1) Go to Online Store
2) Edit Code
3) Find theme.liquid file
4) Add the following code in the bottom of the file above </body> tag


.mega-menu {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.menu-item:hover .mega-menu {
  opacity: 1;
  visibility: visible;
}

 

You can also add pointer-events: none  to .mega-menu by default and enable it on hover:

 

.mega-menu {
  pointer-events: none;
}

.menu-item:hover .mega-menu {
  pointer-events: auto;
}

 

 

Need a Shopify developer? Hire us at Top New York Web Design
Boost Your Store Sales with Volume/Tier Discount Try Big Bulk Discount
Create New Shopify Store For Just 1$/Month
Ravenwoodstore
Excursionist
16 0 7

Hey @topnewyork ,

 

I added the code but it doesn't seem to do anything. The menu doesn't have a fade in/out effect active on it. 

 

thanks!