Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #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.

    https://imgur.com/rkLKcmM

    #1198031

    Hey 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,
    Victoria

    #1198055

    There is support for the license, so I want to get help. Because this solution should be standard.

    #1199642

    Hi,

    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,
    Ismael

    #1206474

    Hello,
    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.

    #1207410

    Hi,
    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,
    Mike

    #1207486

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

    https://ibb.co/pvzxC4c

    #1207767

    Hi,
    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,
    Mike

    #1207771

    Thank you very much works.

    However, the last effect I would like to achieve is that subcategories are visible only after clicking on the parent.

    #1207777

    Hi,
    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,
    Mike

    #1207782

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

    #1208109

    Hi,
    So, you want no hover effect?
    Please point to an example of this behavior on our demo, or any of these demos.

    Best regards,
    Mike

    #1208135

    I sent a link to the example in a private message. This is the effect I’m interested in for the pages menu in widgets.

    https://ibb.co/D4SS2pM

    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.

    #1208155

    Hi,
    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,
    Mike

    #1208156

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

    #1208937

    Hi,
    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,
    Mike

    #1209106

    The code works fine, however, causes the mega munu menu to disappear.

    https://ibb.co/Qp0svP1

    #1209136

    Hi,
    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

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