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

Reply To: Some Contents Missing

#31008
Ernest MarcinkoErnest Marcinko
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.