Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search experience on mobile
This topic contains 4 replies, has 2 voices, and was last updated by breezynetworks07 2 years, 7 months ago.
- AuthorPosts
- September 28, 2020 at 12:00 pm #29558
Hello,
Please take a look at this quick video RE search experience on mobile:
https://www.dropbox.com/s/ycegcavpenfubc9/search-on-mobile.mov
Thanks!
September 28, 2020 at 1:27 pm #29559Hi,
Thank you for the detailed video.
I’m afraid I might not be able to help with this, as unfortunately this is not caused by the plugin. The menu closes automatically, whenever a menu element is clicked, I guess it is an expected behavior. Instead of trying to resolve this via a custom code, first I recommend checking the menu configuration, if there is any option to change to not the close the menu, unless it looses focus, or the user clicks the menu icon again. That would easily resolve this.
I tried to look into a possible custom script, but I cant seem to find which event triggers the menu closing unfortunately. While it is beyond our support, if you happen to know which event might be triggering that (in programmatical terms), then I might be able to suggest something.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 5, 2020 at 3:55 am #29616While I do understand that, please also note that I am not using a menu plugin on mobile.
This is stock standard WordPress submenus?
If you say that there is no solution for this, then your documentation/sales page needs to specifically say something like:
“Please note that you cannot use this search with the default mobile submenu on WordPress”.
I am not happy with this as a resolution, and implore you to figure out something for both myself and future customers. This has basically enough for the client to remove this plugin and look elsewhere.
Thanks
October 5, 2020 at 9:13 am #29618This issue is not generic at all, not standard stock menus (in terms of the additional scripts and styling) – normally, menus does not do this for this exact reason (to prevent issues with other interactive events). Therefore there is no generic solution I can implement to prevent a behavior that should not happen in the first place. Fiddling with other code event handlers will cause more issues only. Programmers cannot think of everything. I am sure, that the menu coder had a good reason to code this behavior – however it prevents combining other interactive items to the menu – which is definitely not promised by them either.
We can try an approach to remove all of the touch and click handlers from the menu, and hope that it prevents the closing. Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_action('wp_footer', 'asp_remove_menu_closing'); function asp_remove_menu_closing() { ?> <script> jQuery(function($){ $('li.menu-item, li.menu-item a').off('touchend').off('touchstart').off('click'); }); </script> <?php }
There is a tiny chance that this may actually work, but may also cause some unexpected behavior, so make sure to test it.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 5, 2020 at 10:29 am #29626Hi Ernest,
I see, that makes sense, and I agree with you.
It must be the theme then that is making some sort of interaction with the menu, I was simply saying that we don’t have a menu plugin installed.
Thanks for the code, I will give it a try.
Cheers
P.S: I will also look for a way to isolate that jquery to just the menu subID
- AuthorPosts
You must be logged in to reply to this topic.