Live Search doesn't close after result click

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Live Search doesn't close after result click

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 1 year, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #41288
    TheWeather
    TheWeather
    Participant

    Hi,

    On my site timedriven.theweather.dev, when I click on a result in the live search the live search results do not immediately close. Instead they remain visible for seconds making the search appear broken. Needless to say the client flagged this as unacceptable 🙁

    How I can fix this? If there is not easy fix, can I open the result in a new tab instead?

    Best,

    Chris

    #41290
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    It is intended behavior, as the redirection itself will clear the window anyways. In your case the issue is, that the integrated top bar closes (containing the search bar) so the results are left on the page.

    You can get by this very easily via a small custom code snippet. Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

    add_action('wp_footer', 'asp_add_footer_script', 99999);
    function asp_add_footer_script() {
    	?>
    	<script>
    	jQuery(function($){
    		jQuery('body').on('click', '.asp_r .item', function(){ 
    			ASP.api(1, 'closeResults'); 
    		});
    	});
    	</script>
    	<?php
    }

    This will trigger a results closing event upon the click, before redirection.

    Best,
    Ernest Marcinko

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


Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Live Search doesn't close after result click’ is closed to new replies.