Reply To: Search not working on fixed scroll header

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Search not working on fixed scroll header Reply To: Search not working on fixed scroll header

#6889
Ernest Marcinko
Ernest Marcinko
Keymaster

Hi!

From what I can see the Sticky Menu has an original and cloned container of itself on the same page. I’m guessing it basically uses the clone for when the sreen is scrolling.
There is a huge problem with that approach: it also clones ajax search pro as well. This is never going to work, as the javascript event handlers cannot be cloned. If you put any kind of javascript event driven element to that menu, it’s going to fail, it’s not exclusive to ajax search pro, nothing would work that way.

I’ve looked at the code via FTP and the header is cloned via javascript, so there is nothing I can do about it. It is simply impossible to clone html element with the event handlers. Moreover it does not change the element IDs either, so there are multiple elements with the same ID, which is invalid HTML as well.

As a solution I would suggest not using javascript cloning in the header menu, instead simply creating the “clone” HTML in the header.php file and remove the javascript cloning completely. That way the same search shortcode would be used twice and it would work correctly. It’s also much faster and safer, and you would be able to use any kind of element in the header that uses javacript.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)