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.

Having trouble getting the mobile menu to match the style of main nav

  • 1. On the mobile menu, the last item (Contact Us) has a different text hover color than the last item on the primary nav. The font is supposed to be var(—primary-ultra-dark) on hover, but it is var(–primary-ultra-light) instead. I’ve set all the settings I can find.
    https://snipboard.io/8xsFlg.jpg.

    2. On the mobile menu, when I hover my cursor over the area between the last two menu items it turns the Contact Us button to the color of the submenu background instead of the color it is supposed to be var(—action) when normal state or var(–action-hover) when it is hovered over.
    https://snipboard.io/9KYXTc.jpg

  • Hi there,

    1. Your CSS can not override the theme menu item hover color, you need to make your CSS more specific or use !important.

    2. And you should add the hover state to the li, not the a. For example, this is your CSS:

     .main-navigation .main-nav ul li.mobile-nav-button a:hover {
                        color: var(--primary-ultra-dark);
                        background-color: var(--action-hover);
    }

    It should be changed to:

    .slideout-navigation.main-navigation .main-nav ul li.mobile-nav-button:hover > a {
                        color: var(--primary-ultra-dark);
                        background-color: var(--action-hover);
    }
  • Changing the CSS on item #2, fixed the issue with item # 1. It also stopped it from using the wrong hover color, but the area here https://snipboard.io/9KYXTc.jpg still activates the hover for the Contact Us link instead of it only activating when the link is actually hovered.

    Also, how do I make the Home link have the blue background on hover. It doesn’t do it on the main or mobile nav.

  • Hi there,

    The ‘Contact Us’ button appears to have the correct hover color from my view. Have you fixed that?

    As for this:

    ..how do I make the Home link have the blue background on hover.

    You can try this CSS:

    .current-menu-item a:hover {
       background: rgb(7, 84, 120);
    }
  • That CSS changed the hover background for the Home button. However, it doesn’t work when I use the variable for the color (–action-dark). Should it work with color variables?

    As for Item 2 from my original question. Yes, the color is fixed, but what I mentioned in my reply is the area here https://snipboard.io/9KYXTc.jpg activates the hover for the Contact Us link instead of it only activating when the link is actually hovered.

  • The color should’ve been var(----action-dark).

    The contact us in the slideout menu has the correct hover color:
    https://app.screencast.com/sop7kbbbvs1GV

    Are you referring to the desktop? If so, you need to change the desktop CSS as well.

  • This is for making the Home link have the blue background like the others. In the customizer, the variable for that color is –action-dark, can you please explain why I need to put two extra — in front of it to get it to work? any other time I use the color variables I just use var(–action-dark) and it works. For this, it doesn’t work unless I have 4 —–.

    Also, I still have a question about Item #2 from my original post. As for Item 2 from my original question. Yes, the color is fixed, but what I mentioned in my reply is the area here https://snipboard.io/9KYXTc.jpg activates the hover color for the Contact Us link instead of it only activating when the link is actually hovered.

  • can you please explain why I need to put two extra — in front of it to get it to work?

    That’s how CSS defined, check this out: https://developer.mozilla.org/en-US/docs/Web/CSS/var

    Yes, the color is fixed, but what I mentioned in my reply is the area here https://snipboard.io/9KYXTc.jpg activates the hover color for the Contact Us link instead of it only activating when the link is actually hovered.

    As I said there’s no hover state on mobile, the hover state color will show when the button is clicked.

  • Maybe I’m not describing it clearly. The Contact Us button works fine when you hover over it on mobile. But it also changes color when you hover over the area between the Services link and the Contact Us button. Is it possible to make it so it just changes when you hover directly over the Contact Us button and not the area above it?

  • The Contact Us button works fine when you hover over it on mobile. But it also changes color when you hover over the area between the Services link and the Contact Us button

    Oh I see, It’s because you added the margin to the a, so the margin is counted into the button, when you hover on the margin, you are activating the hover state for the button.

    So remove margin-top from this CSS:

    
      /* changes size and color of link button on mobile menu- need to add class .mobile-nav-button to last menu item */
                @media (max-width: 1024px) {
                    .main-navigation .main-nav ul li.mobile-nav-button a {
                        background-color: var(--action);
                        color: var(--primary-ultra-dark);
                        text-align: center;
                        line-height: 35px;
                        width: 200px;
                        margin-top: 100px;
                        border-radius: 10px;
                        padding-top: 10px;
                        padding-bottom: 10px;
                        box-shadow: rgba(0, 0, 0, 0.1) 5px 5px 10px 0px;
                    }

    And add the margin to the li:

    .main-navigation .main-nav ul li.mobile-nav-button {
        margin-top: 100px;
    }

    Make sure the above CSS is added to the correct media qeury.

  • That fixed it. Thank you so much for all your help!

  • No Problem 🙂

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