Home / Forums / DynamiX Support / Loading navigation menu (problem with arrows)

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts

  • Pavel
    Participant

    Hi,

    when loading main navigation menu, there are 2 phases:

    1) Menu is loaded with smaller spaces between items.

    2) After short time, spaces are expanded a little (and submenu arrows added).

    It is a little bit disrupting for users. Is it possible to change it somehow? I am not sure if it is problem of some Javascript or standard CSS… But the cause is probably small arrown (sign of submenu), because it can be seen only for menu items with this arrow. This problem is also visible on your DynamiX demo page.

    Thank you for your help.

    Andy
    Andy
    Keymaster

    Hi Pavel,

    It should be quite instant, it checks the menu to see if it has a drop menu and then appends a class to that menu which widens the menu for the drop menu icon. You would have to re-write this process, unfortunately this isn’t something I can cover in the normal support forum.


    Pavel
    Participant

    Hi,

    yes, I also found that the issue is in file nv-script.js (and packed variant). Could you please change the way how “hasdropmenu” class is added? Problem is in Javascript, because menu is loaded with CSS and later class is added by Javascript, so menu is a little expanded while loading. It is small, but really annoying glitch, especially for slower computers with slow internet connection… I found following solution, but it would be fine to add it to another version of your theme:

    1) File nv-script.js (and packed variant), line 215: remove addClass('hasdropmenu') to:

    $('#nv-tabs ul.sub-menu,#nv-tabs ul.children').parent().prepend('<span class="dropmenu-icon"></span>');

    2) Add following code to functions.php (or any other file):

    function themeva_set_dropdown( $sorted_menu_items, $args ) {
    $last_top = 0;
    foreach ( $sorted_menu_items as $key => $obj ) {
    // it is a top lv item?
    if ( 0 == $obj->menu_item_parent ) {
    // set the key of the parent
    $last_top = $key;
    } else {
    $sorted_menu_items[$last_top]->classes['dropdown'] = 'hasdropmenu';
    }
    }
    return $sorted_menu_items;
    }
    add_filter( 'wp_nav_menu_objects', 'themeva_set_dropdown', 10, 2 );

    Now, “hasdropmenu” class will be generated together with generating custom menu and glitch with expanding menu while loading will be away… Tested and works fine…

    Thank you for your help!

    Andy
    Andy
    Keymaster

    Hi Pavel,

    That’s great, thank you for providing that solution – truly appreciated! It’s a better way of adding the class, mine is a little lazy!


    Pavel
    Participant

    Great, thank you!

    I am only fulfilling requests of my client and I want to use child theme to enable easy updates with Envato Toolkit. And that is why I need you to make changes directly to the original theme. It is standard Win-Win situation 🙂

    Andy
    Andy
    Keymaster

    Great, it will be in the next version, thanks! 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.