Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #794920

    Hello

    I used your code from this link to add a search bar to my mobile menu.
    I set – display: none; to the #menu-item-search-mobile to when the menu is not a mobile menu (990px and above).
    The problem is, every time a page loads on desktop screens, the search bar appears for a second, and then disappears once the page is loaded.

    How can I prevent this?
    Thank you!

    #795894

    Hey gb_plugins1,

    Do you have display: none; set for big sizes?

    
    @media only screen and (min-width: 990px) {
    .menu-item.page-item-18 { display: none; }
    }
    

    Best regards,
    Victoria

    #800903

    Hello Victoria,

    I am facing the same issue… every time a page loads on desktop screens, the search bar appears for a second, and then disappears once the page is loaded.

    in functions.php file:

    add_filter( ‘wp_nav_menu_items’, ‘avf_add_search’, 3, 2 );
    function avf_add_search( $items, $args ) {
    if ($args->theme_location == ‘avia’)
    {
    $search = ‘<li id=”menu-item-search-mobile” class=”menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-18 current_page_item menu-item-top-//level menu-item-top-level-5″>’.get_search_form(false).’‘;
    $items = $search . $items;
    }
    return $items;
    }

    in quick css:

    @media only screen and (max-width: 767px) {
    #top #searchform> div {
    display: block !important;
    opacity: 1 !important;
    }
    }

    and for mobile view quick css:

    #menu-item-search-mobile {
    display: block;
    }

    Could you help me please?

    Thank You in advance,

    Nick

    #801085

    Shalom Nick,

    Please change the code in Functions.php file to following one

    add_filter( 'wp_nav_menu_items', 'avf_add_search', 3, 2 );
    function avf_add_search( $items, $args ) {
    if ($args->theme_location == 'avia' && wp_is_mobile())
    {
    $search = '<li id="menu-item-search-mobile" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-18 current_page_item menu-item-top-//level menu-item-top-level-5">'.get_search_form(false).'';
    $items = $search . $items;
    }
    return $items;
    }
    
    

    Best regards,
    Yigit

    #809485

    Hi Victoria,

    I have all the CSS code needed, but it doesn’t solve the problem.

    Thanks!

    #810262

    Hi gb_plugins1,

    Have tried the solution proposed by Yigit? Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?

    Best regards,
    Victoria

    #835858

    Hi Victoria,

    Yigit’s solution worked. thanks a lot!

    #835862

    Hi,

    You are welcome! :)

    For your information, you can take a look at Enfold documentation here – http://kriesi.at/documentation/enfold/
    And if there are features that you wish Enfold had, you can request them and vote the requested ones here – https://kriesi.at/support/enfold-feature-requests/
    For any other questions or issues, feel free to post them here on the forum and we will gladly try to help you :)

    Best regards,
    Yigit

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Mobile menu search’ is closed to new replies.