Tagged: drop down menu, menu, sidebar
-
AuthorPosts
-
March 24, 2020 at 10:22 am #1195957
I added navigation to the widget, which consists of a main category and a sub-category. I would like only the main category to be visible, whereas subcategories only visible after clicking and expanding the menu.
This applies only to categories that consist of a parent and subcategories in the menu.
March 26, 2020 at 2:17 pm #1198031Hey creativeopole,
Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
VictoriaMarch 26, 2020 at 2:57 pm #1198055There is support for the license, so I want to get help. Because this solution should be standard.
April 1, 2020 at 8:08 am #1199642Hi,
Sorry for the delay. Did you remove the sub categories in the widget menu?
You can try the modification that @mike provided in the previous thread.
// https://kriesi.at/support/topic/tweaks-2/#post-1173326
If it doesn’t work, you can try this example.
// https://www.w3schools.com/css/css_dropdowns.asp
The modification will initially hide the child categories and only display them when the parent category is hovered.
Best regards,
IsmaelApril 23, 2020 at 9:06 am #1206474Hello,
I would count on support and help in implementing the drop-down menu after clicking on the sidebar. Alternatively, implement this option in the template core. Because this is the basic solution that should be able to enable every user using your template.April 27, 2020 at 1:05 am #1207410Hi,
Sorry for the late reply, I took a look at your widget navigation and adjusted the function to work for your site, but the only thing is your parent menu items need to not link to a page, just “#” because they can’t toggle and be a link at the same time.
Once you remove the links from the parent items, add this code to the end of your functions.php file in Appearance > Editor:function widget_menu_dropdown(){ ?> <script> (function($){ $(document).ready(function(){ $('#menu-sidebar-oferta-1 > li.menu-item-has-children').find('ul').hide(); $('#menu-sidebar-oferta-1 > li.menu-item-has-children').click(function () { $('#menu-sidebar-oferta-1 > li.menu-item-has-children').not(this).find('ul').hide(); $(this).find('ul').toggle(); }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'widget_menu_dropdown');
I also tried the function using hover to toggle and it seems to work well allowing you to also use the parent links. Please give this a try in your functions.php, but don’t try both at the same time.
function widget_menu_dropdown_two(){ ?> <script> (function($){ $(document).ready(function(){ $('#menu-sidebar-oferta-1 > li.menu-item-has-children').find('ul').hide(); $('#menu-sidebar-oferta-1 > li.menu-item-has-children').hover(function () { $('#menu-sidebar-oferta-1 > li.menu-item-has-children').not(this).find('ul').hide(); $(this).find('ul').toggle(); }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'widget_menu_dropdown_two');
Best regards,
MikeApril 27, 2020 at 12:33 pm #1207486It works, but it is not an effect that pleases me.
I would like the list of main categories and subcategories to be active after clicking.
April 28, 2020 at 12:49 pm #1207767Hi,
Sorry, you can’t add a click event to the parent item because it is already a link. But if you add this css to your Quick CSS the menu will be expanded when on the parent or sub pages.li.current_page_item.menu-item-has-children > ul.sub-menu,li.current_page_ancestor.menu-item-has-children > ul.sub-menu { display: block !important; }
Best regards,
MikeApril 28, 2020 at 12:57 pm #1207771Thank you very much works.
However, the last effect I would like to achieve is that subcategories are visible only after clicking on the parent.
April 28, 2020 at 1:21 pm #1207777Hi,
To do this you will have to remove the links from the parent items, right now if you click a parent you go to a URL, you can’t have a second click event because the browser doesn’t know if you want to open the menu or go to the URL.
I can override the first click event, but you will not be able to use those parent links.Best regards,
MikeApril 28, 2020 at 1:42 pm #1207782But removing the parent link is not good in terms of service usage and SEO. The menu works so that when clicked, it also includes in the main category and displays underneath the subcategories that are visible after clicking and not hovering.
After all, such navigations are found, even in enfold, when we have a woocomerce, the drop-down menu is clicked and the links work for the main category and subcategory.
And this is the solution I would like to achieve for the widgets menu.
April 29, 2020 at 11:37 am #1208109Hi,
So, you want no hover effect?
Please point to an example of this behavior on our demo, or any of these demos.Best regards,
MikeApril 29, 2020 at 12:32 pm #1208135I sent a link to the example in a private message. This is the effect I’m interested in for the pages menu in widgets.
I am interested in this effect after clicking. Only after clicking on the menu does the list of categories expand. All links are active and can be accessed.
April 29, 2020 at 1:34 pm #1208155Hi,
Thanks for the link, this sidebar menu doesn’t show the behavior you described, the sub-menu items don’t dropdown or show on click. When you click the parent item you go to the page, then the sub-menu is shown, but it doesn’t toggle when clicked.
For this behavior, please remove the function above and only use this css:li.current_page_item.menu-item-has-children > ul.sub-menu,li.current_page_ancestor.menu-item-has-children > ul.sub-menu { display: block !important; }
Best regards,
MikeApril 29, 2020 at 1:46 pm #1208156It did not change anything, on the contrary, it returned to its basic appearance.
The main category must be a link, while the subcategories are to show up only when we click on the main category.
May 1, 2020 at 8:36 pm #1208937Hi,
Sorry, the css was missing a rule, please try this css instead:li.menu-item-has-children > ul.sub-menu,li.menu-item-has-children > ul.sub-menu { display: none !important; } li.current_page_item.menu-item-has-children > ul.sub-menu,li.current_page_ancestor.menu-item-has-children > ul.sub-menu { display: block !important; }
Then clear your browser cache and check.
Best regards,
MikeMay 2, 2020 at 3:52 pm #1209106The code works fine, however, causes the mega munu menu to disappear.
May 2, 2020 at 7:29 pm #1209136Hi,
Sorry, please try this css instead:#nav_menu-2 li.menu-item-has-children > ul.sub-menu,#nav_menu-2 li.menu-item-has-children > ul.sub-menu { display: none !important; } #nav_menu-2 li.current_page_item.menu-item-has-children > ul.sub-menu,#nav_menu-2 li.current_page_ancestor.menu-item-has-children > ul.sub-menu { display: block !important; }
Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.