-
Anonymous
Hi,
I want to add both a hamburger menu and a horizontal scrollable menu to my website for mobile devices only like ndtv. The desktop layout is fine as it is. Is this possible?
-
David
Hi there,
you would need to add the Secondary Navigation to your site:
https://docs.generatepress.com/article/secondary-navigation-layout-overview/
And see this doc which explains how to keep the secondary nav always in desktop horizontal mode on mobile:
https://docs.generatepress.com/article/disable-secondary-navigation-mobile-menu/
If you want to set that up on the site, and once I can see it on the site, I can provide some CSS to make the nav scrollable
-
Anonymous
Hello,
I have added the secondary navigation and hidden it from the desktop version. Now, I want the horizontal scroll submenu to appear below the mobile main navigation (screenshot), similar to NDTV. Could you please provide the CSS to achieve this?
Thank you for your help!
-
Alvind
Hi there,
Can you implement this on the secondary menu to display horizontally first: https://docs.generatepress.com/article/disable-secondary-navigation-mobile-menu/
After that, we can work on the CSS for the scrollable effect.
-
Anonymous
Hi there,
I have made the secondary menu display horizontally as per the instructions. Can you now provide the CSS for the scrollable effect and position it below the main header?
Thank you for your assistance!
-
David
To move it below the header
Go to Customiser > Layout > Secodndary Navigation and check the Location to Below HeaderTo make the nav scrollable add this CSS:
/* Add horizontal scrolling */ nav#secondary-navigation .inside-navigation .main-nav ul { display: flex; flex-wrap: nowrap; width: fit-content; } nav#secondary-navigation .inside-navigation .main-nav { overflow-x: scroll; } nav#secondary-navigation .inside-navigation .main-nav ul li { white-space:nowrap; } /* Hide the scrollbar */ nav#secondary-navigation .inside-navigation .main-nav { overflow: auto; -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */ scrollbar-width: none; /* Hide scrollbar for Firefox */ -webkit-overflow-scrolling: touch; /* Add smooth scrolling for Webkit browsers */ } /* Hide scrollbar for Chrome, Safari, and Opera */ nav#secondary-navigation .inside-navigation .main-nav::-webkit-scrollbar { display: none; /* Hide scrollbar for Chrome, Safari, and Opera */ }
-
Anonymous
It worked. Thank you very much for your help David.
-
David
Glad to hear that
- You must be logged in to reply to this topic.