Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #1206133

    Hi there,
    On the page of our client, we used anchor links.
    If you are in Chrome and on the Homepage while using the menu, the anchor link on the new page is above the view, when the page is loaded.
    Below are some links and infos, do you have any idea why this is happening?

    Thank you very much,


    Hey ksalewski,
    Sorry for the late reply, it looks like you are getting an early error Uncaught TypeError: Cannot read property 'innerHTML' of null from:

        jQuery(window).load(function() {
            var el = document.querySelector('.avia-caption-title');
            el.outerHTML = '<h1 class="avia-caption-title ">' + el.innerHTML + '</h1>';

    This looks like a custom script, perhaps in your functions.php? Please try removing it and clearing your cache then test your menu item.
    Best regards,


    Hi There,
    Thank you for the reply! I removed the script and cleared the cache, sadly the problem is still there.
    We only discovered it shortly after the update to WordPress 5.4 was made.

    Many thanks,


    I believe that the page is going to the anchor but the page is not fully loaded yet, so when the page is finished loading the position of the scroll is not correct. This seems to help.
    Try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_scroll_script(){
    (function($) {
      $('a[href*="#"]:not([href="#"])').click(function() {
          var target = $(this.hash);
              scrollTop: target.offset().top - 90
            }, 'linear');   
    	if (location.hash){
        var id = $(location.hash);
    	$(window).load(function() {
      	if (location.hash){
        	$('html,body').animate({scrollTop: id.offset().top -90}, 'linear')
    add_action('wp_footer', 'custom_scroll_script');

    Please add this function and clear your browser cache and check.

    Best regards,


    Hi Mike,

    Thank you very much for the help! This worked for us!

    Best regards,



    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Anchor jumps too far in Chrome’ is closed to new replies.