Support » Fixing WordPress » Page scrolls back to top after initial jump to the anchored link when loading

  • Hi,

    I am trying to put some cross-page links, that direct not just to the page, but to a specific part of it (anchoring them). However, when I follow the link, the page initially scrolls to the anchor, but after half a second jumps to scroll back to top. What can the problem be and how can I fix it?

    Thank you!

    • This topic was modified 4 months, 2 weeks ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • What happens if you deactivate the Page-Links-To plugin?

    Thread Starter memymilk

    (@memymilk)

    Hi,

    I have just tried it and unfortunately nothing changes, the page still goes to the anchor and then immediately scrolls back to top.

    See this error in the console:
    https://ibb.co/Fwr3LPJ

    It looks like WordPress has updated jQuery, but your theme is using old jQuery functions. Try adding this to your functions.php:

    add_action( 'wp_enqueue_scripts', 'load_old_jquery_fix', 100 );
    function load_old_jquery_fix() {
        if ( ! is_admin() ) {
            wp_deregister_script( 'jquery' );
            wp_register_script( 'jquery', ( "//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" ), false, 
    
    '1.11.3' );
            wp_enqueue_script( 'jquery' );
        }
    }
    Thread Starter memymilk

    (@memymilk)

    I added it to functions.php and now the anchor links do not work even inside a single page, which is super weird!

    Can you update your theme and any plugins?

    If that doesn’t work, what happens if you deactivate all your plugins?

    Thread Starter memymilk

    (@memymilk)

    When the problem occurred the first thing I did was to deactivate all the plugins, but the problem still persists, so seems like it is not coming from any plugins. Unfortunately the theme seems to have been updated a while ago and there are no new releases, so at this point I am trying to somehow deactivate this scrolling to top behaviour in it, but can not seem to find out where exactly it is coming from 🙁

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.