Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @jacquesntc

    You’re right, the page is loaded twice and the second time without the anchor tag, moving back to the top.

    This is coming from the following JS script: https://help.netcash.co.za/wp-content/plugins/wedocs/assets/js/frontend.js There is a function (lines 415-418) for this purpose for an unknow reason:

    // Handle hash router.
     if ( window.location.hash ) {
       window.location = window.location.pathname;
     }

    This JS file belongs to weDocs plugin.

    I recommend you to browse the documentation of the plugin available here to see if it’s something configurable: https://wedocs.co/docs/wedocs/ (the same issue is happening on their side as well by the way). Otherwise, you should probably open a ticket on the support forum dedicated to the plugin.

    Best of luck!

    Thread Starter jacquesntc

    (@jacquesntc)

    Such a legend. let me browse this and check this out, maby i can manipulate a few things … thanks for the directional search, just incase where and how did you spot this issue

    You’re welcome!

    The Network Monitor of Firefox DevTools allows to block specific HTTP requests. I used it to isolate the JS file responsible of the redirect.

    @jacquesntc It looks like your issue is now fixed. Well done! Feel free to share how you did it and please, don’t forget to mark this topic as resolved in the sidebar. This helps the volunteers find the topics that still need attention. Thank you!

    Thread Starter jacquesntc

    (@jacquesntc)

    $(function() {
    // Function to scroll to the top
    function scrollToTop() {
    $(‘html, body’).animate({ scrollTop: 0 }, ‘fast’);
    }

    // Prevent horizontal scrolling
    $(‘body’).css(‘overflow-x’, ‘hidden’);

    // Handle hash router.
    if (window.location.hash) {
    // Scroll to top if there is a hash
    scrollToTop();

    // Handle hash router after a short delay to ensure scrolling is complete
    setTimeout(function() {
      window.location = window.location.pathname;
    }, 500);

    }
    });

    added this in the code in the plugin as mention in previous replies

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Anchor Tag scroll to top after load issue’ is closed to new replies.