Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Hamburger and Scrollable Menus for Mobile

  • 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?

  • 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

  • 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!

  • 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.

  • 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!

  • To move it below the header
    Go to Customiser > Layout > Secodndary Navigation and check the Location to Below Header

    To 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 */
    }
    
  • It worked. Thank you very much for your help David.

  • Glad to hear that

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.