Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is it possible to create a web part that publishing page editors can insert and all it contains is an anchor tag to take the user "Back to Top" of the page?

I've added this to the top of the pages' HTML:

<a id="top">

Then, I'd like non-HTML coders to be able to add this anywhere they'd like on SharePoint 2010 publishing pages:

<a href="#top">Back to Top</a> 

Your help is much appreciated. Thanks.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

It should be id="Top" instead of name="Top"

It should be rather easy. Insert a HTMLform webpart and insert your <a href="top">Go to top</a>, save it and export the webpart and call it "BackToTopWP". Then you can import it and it should be available for all admins/moderators/whatever to insert.

share|improve this answer
    
Thanks, Dandroid; correction has been made. Any way to add this as a web part for editors to insert into pages. –  Alex C Dec 2 '11 at 13:45
1  
@AlexC Please view my edit :) –  Daniel Ziga Dec 2 '11 at 13:47
1  
One other thought: Can this be automated? In other words, can jQuery parse a particular area of the page layout on the pub page and auto insert this link after every web part/paragraph of text? Just a thought. Thanks again for the help. –  Alex C Dec 3 '11 at 6:21
2  
@AlexC Indeed it can. If it is supposed to be placed within webparts, you can make jQuery insert this very link into them as all webparts have the same HTML structure untill you hit the ms-WPBody div. The jQuery would look something like this: $('.ms-wpTopTable .ms-WPBody p').append('<a href="#top">Go to top</a>'); –  Daniel Ziga Dec 3 '11 at 11:56
    
Thanks, Dandroid. Your help is much appreciated :) –  Alex C Dec 3 '11 at 16:47
add comment

SharePoint pages already include a #mainContent anchor that you could reuse:

<a href="#mainContent">Back to Top</a>

I think it is also associated with the accesskey J.

share|improve this answer
    
Thanks, ref to maincontent is easier to implement –  user9952 Aug 8 '12 at 11:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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