-
AuthorPosts
-
May 25, 2021 at 4:00 pm #1302243May 27, 2021 at 11:13 am #1302575
Hey amyteslin,
Thank you for the inquiry.
This option is not available out of the box, but you may be able to utilize the same script that we use to create social icons inside the mobile menu. The script can be found here.
// https://kriesi.at/support/topic/add-logo-to-slide-out-mobil-menu/#post-1301439
Just replace this line with the actual markup of the search bar.
$(" <div class='av-mobile-logo'><img src='IMAGE URL HERE' /></div> ")
And remove this part or change it accordingly.
.addClass("mobile_social_bookmarks");
Best regards,
IsmaelMay 27, 2021 at 12:54 pm #1302620This reply has been marked as private.May 28, 2021 at 12:17 pm #1302813Hi,
Thank you for the update.
We cannot see the actual markup of the search bar above. Please post the code on pastebin.com so that we can test it on our end. The code should look something like this.
// add search bar to mobile menu function ava_custom_script_mod_search_mobile() { ?> <script> (function($) { $(document).ready(function() { $('.av-burger-menu-main a').on('avia_burger_list_created', function() { setTimeout(() => { $("<div class='av-mobile-search'>SEARCH HERE</div>").prependTo('#av-burger-menu-ul'); }, 150); }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'ava_custom_script_mod_search_mobile', 10000);
Best regards,
IsmaelNovember 13, 2022 at 1:53 pm #1372401Hi Ismael,
I would like to put the search function with the search icon (as your standard search function looks like) into the mobile menu as first item of the list.
Your code above sets the words “search here“ at the right place. Can you help me with changing this into the search icon with the search function?
Thank you.
Best regards,
VeraNovember 13, 2022 at 3:44 pm #1372412Hi,
To add the ajax search icon to the top of the burger menu add this function to your child theme functions.php:function add_ajax_search_icon_to_burger_menu(){ ?> <script> (function($){ $('#avia-menu').one('click', function(){ $('#menu-item-search').clone().wrapInner('<li class="burger_search"/>').children(0).unwrap().prependTo('#av-burger-menu-ul'); $('#top #wrap_all #av-burger-menu-ul > li').css({'-webkit-transform':'none'}); }); $('#avia-menu').click(function() { setTimeout(function(){ if ($('#av-burger-menu-ul').is(":visible")) { $('#menu-item-search').css({'visibility':'hidden'}); }else{ $('#menu-item-search').css({'visibility':'visible'}); } },500); }); })(jQuery); </script> <?php } add_action('wp_footer', 'add_ajax_search_icon_to_burger_menu');
Please note that you need to have the search icon enabled in the theme options at Enfold Theme Options ▸ Main Menu ▸ General ▸ Append search icon to main menu
this is the expected results with the burger menu open:
and when the search is used:
Best regards,
MikeNovember 13, 2022 at 4:54 pm #1372419Hi Mike,
great.
The only detail: I have now two search icons. One next to the hamburger icon and the other in the mobile menu (because the desktop version of the website has a navigation with mobile menu).
Thank you for little extra help.Best regards,
VeraNovember 13, 2022 at 6:08 pm #1372421Hi,
The script is written so that when the burger menu is opened the one at the top is hidden and when the burger is closed the one at the top is shown again.
Is it not working for you in this way?
Or do you wish that the header search icon never shows and is only available in the burger menu?Best regards,
MikeNovember 14, 2022 at 9:20 am #1372479Hi Mike,
your second point is what I’m aiming at. The search icon should only be available in the burger menu (because the site only uses the burger menu).
Best regards,
VeraNovember 14, 2022 at 2:57 pm #1372507Hi,
Ok, try using this function instead:function add_ajax_search_icon_to_burger_menu_no_desktop_search(){ ?> <script> (function($){ $('#top #wrap_all #menu-item-search').css({'visibility':'hidden'}); $('#avia-menu').one('click', function(){ $('#menu-item-search').clone().wrapInner('<li class="burger_search"/>').children(0).unwrap().prependTo('#av-burger-menu-ul'); $('#top #wrap_all #av-burger-menu-ul > li').css({'-webkit-transform':'none'}); }); })(jQuery); </script> <?php } add_action('wp_footer', 'add_ajax_search_icon_to_burger_menu_no_desktop_search');
Please note that you still need to have the search icon enabled in the theme options at Enfold Theme Options ▸ Main Menu ▸ General ▸ Append search icon to main menu
Best regards,
MikeNovember 14, 2022 at 3:23 pm #1372513Hi Mike,
great, that works.
Thank you very much!
Best regards,
VeraNovember 14, 2022 at 6:24 pm #1372546 -
AuthorPosts
- You must be logged in to reply to this topic.