- This topic has 9 replies, 3 voices, and was last updated 5 years, 7 months ago by Tom.
-
AuthorPosts
-
August 20, 2018 at 5:03 am #654154Sunny
Hello,
I am using the Sider template. On mobile menu the text is aligned to Center by default and on looking into the code it seems to be marked as important in the parent theme.
Any idea on how can I align the menu items towards left?
August 20, 2018 at 6:31 am #654254DavidStaffCustomer SupportHi there,
if you go to Customiser > Additional CSS and look for and remove the following CSS:
.main-navigation.toggled .main-nav li { text-align: center !important; }
August 20, 2018 at 6:44 am #654277SunnyThank you! Works fine now.
I have another question regarding the menu on Desktop, currently when you have dropdown menu items and when you click one of the dropdown items, the dropdown menu closes. How can I keep the dropdown menu open?
August 20, 2018 at 6:58 am #654289DavidStaffCustomer SupportThis topic may be of help:
https://generatepress.com/forums/topic/expand-submenu-on-mobile-while-on-subpage/
August 22, 2018 at 1:29 am #656517SunnyHey David, thanks for the tip it helped.
One issue though, suppose I open the sub menu by clicking the parent menu item. Now when click the sub menu item the page reloads to open that specific page. Since the page reloads the menu closes, how can we keep it open.
Like for example how they have done it here – https://www.audi.com/ci/en/intro/basics/layout-structure.html
August 22, 2018 at 6:33 am #656717DavidStaffCustomer SupportAh ok, so this may be the solution that Tom provides a link to hear:
https://generatepress.com/forums/topic/active-submenus/#post-630859
August 23, 2018 at 5:57 am #657763SunnyAlmost there!
Just one last thing, when the sub menu is open and I click on a sub menu item the menu stays open. That’s perfect but at the same time when I click on other menu the existing opened sub menu doesn’t close. How can I close that?
August 23, 2018 at 9:42 am #658074TomLead DeveloperLead DeveloperInstead of this: https://generatepress.com/forums/topic/css-bug-in-sider/#post-656717
You could try this:
add_action( 'wp_enqueue_scripts', function() { wp_enqueue_script( 'jquery' ); } ); add_action( 'wp_head', function() { ?> <script> jQuery( document ).ready( function($) { $( '.current-menu-ancestor' ).addClass( 'sfHover' ).find( '.sub-menu' ).addClass( 'toggled-on' ); } ); </script> <?php }, 999 );
Let me know 🙂
August 23, 2018 at 10:15 am #658117SunnyPerfect Tom. This worked like a charm.
Though one more issue, on my site I am mostly using anchor links in the sub menus. So when I click on a sub menu item then all the other links of that particular menu changes to same color. Instead I would it to change it only for that link which I clicked.
August 23, 2018 at 6:20 pm #658457TomLead DeveloperLead DeveloperUnfortunately there’s not an easy way to deal with that.
WordPress adds the
current-menu-item
class to menu items when we’re on that particular page. You would have to tell WordPress not to highlight those menu items by default.Then you’d need a JS solution to highlight links when we get to their anchor. I believe this plugin does that: https://wordpress.org/plugins/page-scroll-to-id/
-
AuthorPosts
- You must be logged in to reply to this topic.