This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Disable click event on results ?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Disable click event on results ?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #44842
    Stephen GhommidhStephen Ghommidh
    Participant

    Hello,

    I would like to disable click event on results.
    I modified the template to remove the <A> tag, but the event is a javascript event (isotopicClickhandle for me)

    I need to disable the click event because I would like to have my own event (like directly open a photo galery in a lightbox)

    Regards

    #44844
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    I would suggest using this custom code to override the default event handlers:

    add_action('wp_footer', 'asp_custom_footer_script', 99999);
    function asp_custom_footer_script() {
    	?>
    	<script>
    	window.addEventListener("load", (event) => {
    		let $ = WPD.dom;
    		$('.asp_m').on('asp_results_show', function(){
    			$('.asp_r .item').on('click', function(e){
    				e.preventDefault();
    				e.stopImmediatePropagation();
    				// your custom code here
    			});
    		});
    	});
    	</script>
    	<?php
    }

    Within this you can add your own event handler as you need it.

    #44845
    Stephen GhommidhStephen Ghommidh
    Participant

    So great answer!
    I forgot the stop propagation in my js code.

    Works perfectly now!

    #44849
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    #44856
    Stephen GhommidhStephen Ghommidh
    Participant

    You can close it of course.
    This plugin is amazing 😉

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Disable click event on results ?’ is closed to new replies.