Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Some Contents Missing › Reply To: Some Contents Missing
January 5, 2021 at 1:36 pm
#31008
Keymaster
Thanks! It was actually there, but the siteground optimizer moved it to an external file for caching, I could not see it there.
I made a change to the actual script file, which may actually work, the final code is now:
add_action('wp_footer', 'asp_custom_wp_footer');
function asp_custom_wp_footer() {
?>
<script>
jQuery(function($) {
var t;
$('.asp_main_container').on('asp_search_start', function(){
clearTimeout(t);
var $this = this;
t = setTimeout(function(){
$('body,html').animate({'scrollTop': $($this).offset().top - 240}, {"duration": 240});
}, 50);
});
});
</script>
<?php
}
I had to disable the scroll to results feature for this to work. Please note that I cannot guarantee this code to work in all cases on all search bars. For further improvements, you may have to consult with an external developer as well.