Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Scroll to top when clicking on the navigation links › Reply To: Scroll to top when clicking on the navigation links
Your code looks okay, but I would recommend a slightly different approach. If the event handler does not attach, the code might not be positioned correctly – or the event handler gets detached, as the results are dynamically changing.
I would suggest something like this:
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!
This appears to be working on my end. The jQuery ‘on’ handler is better attached to the results div, as the results content is constantly changing, and the handler can get detached on dynamically changing elements.Best,
If you like my products, don't forget to rate them on codecanyon :)