I would like to insert a button to a SharePoint page which slides the opened site to a specific Web Part.

I guess there is any solution with jQuery.

To describe the problem:

I have two document libraries on one page.

Both have kinda much content, that's why I would like to have a button which can scroll (onclick) the page to the second Web Part.

1 Answer 1


First add a CEWP and add in this:

<a onclick="goToAnchor('anchor')" href="#anchor">Anchor</a>

function goToAnchor(anchor) {
  var loc = document.location.toString().split('#')[0];
  document.location = loc + '#' + anchor;
  return false;

And down below where you want to go to (Slide to), add another CEWP and paste this into it:

<p id="anchor">This paragraph is the anchor<p> 

You can set the Chrometype to "None", then you get only the text from the CEWP. If you completly want to hide that, you can use CSS to do so. e.G.:

<p id="anchor" style="visibility: hidden;">This paragraph is the anchor</p>

That's more HTML and CSS than SharePoint.


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.