On my SharePoint 2010 deployment I used Bookmarks to navigate to particular headlines. I implemented bookmark links on the page itselfe to navigate within the page and on the welcome page to direct the users to the content they need.

But there is a Problem. The first implementation of the Bookmark-Links work (On the Page itselfe) but the other one doesn't work properly. In the first moment it seems to be ok (The Page opens on the Menu that was expected) but after a short time (<1sec) the top of the page is displayed, like i would have navigated to the "top of the page".

Can anyone help me, please?


There has been always a problem with anchor bookmarks in SharePoint 2010, the culprit is sp.core.js file

It seems a duplicate of existing questions here:
Sharepoint 2010 and Anchor Tags
Do named anchors work in SP2010?

A little late to the party on this, but I just experienced this issue myself and came up with a fairly effective solution.

As Lori said, it seems that SharePoint's built in JS can force scroll issues that prevent anchors from working properly. The first issue you might run into is the fixed-ribbon scrolling problem that has been pretty well documented. Essentially the tag never scrolls, it's the inner #s4-workspace tag that does all the scrolling. If you need to fix this issue, I recommend Kyle Schaeffer's explanation.

Once you're past that, you may still have some issues. I was experiencing the "jump" that you mention because pages were trying to load at the anchor position, and then a SharePoint JS file was forcing a scroll back to the top of the page. I eventually narrowed this down to the sp.core.js script, which allows the following JavaScript code to correct the problem:

function scrollToAnchors() {
   if (window.location.hash != "") {
       window.location.hash = window.location.hash;
ExecuteOrDelayUntilScriptLoaded(function () { scrollToAnchors(); }, "sp.core.js"); 

Hope this can help someone.

  • How do I imlpement the above Javascript code? Is it a case of adding a Content Editor webpart and pasting this in? If so, this doesnt seem to work for me.
    – jahlive
    May 10 '16 at 10:43
  • Yes adding it to the content editor web part / script editor web part should work. If this does not work, look for other available solutions and when you get it working kindly post the solution here May 10 '16 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.