• Resolved sunil.ch

    (@sunilch)


    Hello There,
    Awesome theme, fulfill my requirements well..

    Trying to modify a menu feature…spent a lot of time in it..but no luck.

    I am just trying to modify the menu in a way that the functionality it is providing with “ontouchstart” event …like when we hover the menu item, if is having sub-menu then sub menus opens up….as we hover any other item the first one closes and the sub menus of that item opens up…just like accordion effect. I like this…but i need this for “onclick” event.

    I have modified the code for it but not able to get completely what I want. My code is :

    (function($){
      $(document).ready(function() {
        $('.toggle-sidebar').click(function() {
          $('.row-offcanvas').toggleClass('active');
        });
    
        $('.toggle-navigation').click(function() {
          $(this).toggleClass('open').next('#site-navigation').slideToggle(300);
        });
    
        $('#site-navigation .sub-menu').before('<i class="fa fa-caret-right"></i>');
        $('#site-navigation .children').before('<i class="fa fa-caret-right"></i>');
    
        if(!!('onclick' in window)){
          $('#site-navigation .menu-item-has-children .fa').click(function() {
            $(this).toggleClass('open').next('ul').slideToggle(300);
          });
        } else {
          $('#site-navigation .menu-item-has-children').not('.current-menu-parent').not('.current-menu-ancestor').hover(function() {
            $(this).children('.fa').toggleClass('open').next('ul').stop(true, true).slideToggle(300);
          });
        }
      });
    })(jQuery);

    Fome the above code, menus are opening up with “onclick” but when we click on another li which is having sub-menu then the it opens up but the previous li is not closing.

    I want this should work as accordion.

    Please Help ASAP

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey there,

    The theme doesn’t support this customization and as much as I’d love to help you with some custom code, it is beyond the support offered for our products. However, we recommend jobs.wordpress.net for your customization needs. Hope you understand.

    Thread Starter sunil.ch

    (@sunilch)

    Thanks Suyogya Shukla,

    Good to get your reply, but I have changed the scenario with the use of wp tree plugin for menu..and now its working fine.

    Thanks
    Sunil

    Hey Sunil,

    Glad you figured it out. Please mark this thread as resolved. Cheers ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Modify menu to work with onclick event’ is closed to new replies.