Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search not working on mobile version
This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko 6 years, 10 months ago.
- AuthorPosts
- November 3, 2017 at 5:05 pm #15377
Hi Support,
The search doesn’t appear to be working on the mobile. I have deactivated the theme and set to WP default theme and it appears to work ok. I have backed up all files and database. Can you help as we really love the search function on the website. Hopefully you have all the necessary credentials to access the website.
Regards
Rob
November 6, 2017 at 9:52 am #15389Hi Rob,
It happens because the menu script creates a DOM copy of the search element, instead of showing the same one as on the desctop version. This is a very bad developer practice, as it essentially clones the original search bar, in this case creating invalid HTML output, as elements with the same ID will be present on the page multiple times. Cloning does not copy the event handlers either – that is why the copied search instance does not work.
Some menu solutions do this, as they are designed to hold simple non-script powered elements, like a simple search form, links, images etc.. However in this case, there is a difference, as this search bar requires scripts to control it’s functionality – handling the live search requests, clicks on settings/magnifier buttons and many other different events. The plugin tries to correct this issue, however the duplicate element IDs prevent the script from initializing correctly.
In these very rare cases I usually recommend either moving the search bar to a different position, or using a different menu solution, that uses custom CSS instead of cloning by script to move it’s elements.
I have made a custom script that might be able to get around this issue, but please keep in mind that this is a very nasty solution, and may not work in all cases. Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
November 6, 2017 at 8:37 pm #15404Hi Ernest,
Thank you for such a prompt response. I have added your script to functions.php and it works! I have only tested it on the iphone but will test on other mobiles as well. Excellent support – thank you.
Regards,
Rob
November 7, 2017 at 10:20 am #15408You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.