anchor lands in wrong part of target page

  • Unknown's avatar

    Having trouble recently where links to anchors I’ve placed in key locations on the website aren’t working properly. They tend to land several paragraphs before the anchor location, causing confusion. I’ve done a few searches online, and this seems to be a common problem in WordPress. What can I do?

    Example: On this page: https://columbiafirstbank.wordpress.com/columbia-federal-through-the-years-2/, there is a hyperlink that says ‘Virginia branch’ which is linked with an anchor on this page: https://columbiafirstbank.wordpress.com/columbia-federal-through-the-years/#1952. It used to work, but now it lands quite a bit higher on the page, and you have to scroll down to find the place where it’s supposed to land. I thought it was because I copied a page to split up the content, but I’m finding it happening in other places, too. Even if you type in the full URL for the anchor, it lands in the consistently wrong place. If you refresh the page enough times, it finally starts jumping to the right spot until you move off the page, and then it goes right back to the wrong spot the next time. I’ve cleared my cache, I’ve tried different browsers, and different devices, and they are all doing the same thing. What gives?

    WP.com: Yes
    Jetpack: No
    Correct account: Yes

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    For what it’s worth, the theme is twenty-twelve, and there are no plugins.

  • Unknown's avatar

    CLARIFICATION: The problem seems to happen when I change the default font settings to larger type. The “normal” setting displays too small on small devices. “Large” works perfectly, but it hoses the anchor links. Still, what gives? An anchor is an anchor – why would the font size affect where it lands?

  • Unknown's avatar

    @pixelvwp I couldn’t post on your question because it’s closed, but since I’m having exactly the same problem, maybe the solution will be the same, too. The problem started when I changed text size for my site to “large” in the font settings in theme customization because of challenges viewing my site on a small screen. When I change the font size back to “normal” the anchor navigation works fine. Unfortunately, “normal” = “nearly microscopic” on a small device, but at least the navigation is working!

    Still no explanation why links to anchors don’t navigate properly when you use a different font setting. As far as I can tell, it should still find the anchor and land there. It’s almost like WordPress is formatting the target page based on “normal” font size, then jumping to the anchor, and then increasing the font size afterwards, so everything shifts farther down on the page, but the screen doesn’t move from the position where it originally landed, forcing you to manually scroll down to where the anchor is.

    Maybe it’s just a quirk with the theme, but I love my theme, and it’s too much trouble to change it, so I guess I’ll have to live with it. Hope this helps.

  • The topic ‘anchor lands in wrong part of target page’ is closed to new replies.