Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1427372

    hi
    I found some code here: https://kriesi.at/support/topic/ search-as-part-of-fly-over-menu/#post-1372412
    that allows me to add a search icon to the top of the mobile menu:

    /*add search to top of mobile menu*/
    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');

    Is there a way to move it to the bottom instead?
    thanks
    Nancy

    #1427396

    Hi Nancy,

    Please try to use this code:

    /*add search to the bottom of mobile menu*/
    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().appendTo('#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');

    Hope it helps.

    Best regards,
    Nikko

    #1427443

    thanks Nikko, I’ll give that a try.

    #1427504

    Hi Munford,

    You’re welcome :)
    Just let us know how it goes.

    Best regards,
    Nikko

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