This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Ajax search pro mobile issue

#26789
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

I see the code on the site footer, you put it to the correct location – the end of the functions.php file is perfectly fine, although it does not matter.
Maybe the menu is initialized later, after this code is executed, so it has no effect. Can you try this variation, I added a delay to it:

add_action( 'wp_footer', 'asp_try_fixing_menu_close', 99999999 );
function asp_try_fixing_menu_close() {
	?>
	<script>
	jQuery(function($){
		setTimeout(function(){
			$('.menu-item a').on('touchstart', (function(e){
				if ( $(this).find('.promagnifier').length > 0 ) {
					$(this).off();
				}
			}));
		}, 1500);
	});
	</script>
	<?php
}

I’m almost certain, that this will do it.