Skip to main content

MOSS KB

Go Search
Lee Allen
Blog
Photo Albums
Stacks
MOSS KB
Demo
Search
Career
CIVoNY
eVony
SandBox
Your Ultimate Basement
  
Lee Allen > MOSS KB > Wiki Pages > Jump to the top of a page  

Jump to the top of a page

Sometimes certain web parts cause your web page to scroll to the bottom of the page when the page loads.  This is an annoying behavior.  You can use this technique to work around the problem. 
 
To resolve this problem a Content Editor web part is placed on the page that contains a simple JavaScript script that will scroll to the top of the page.  Follow these steps:
  1. Place the page in edit mode ("Edit Page" in the "Site Settings" menu)
  2. In the column with the most content and the offending web part click on the "Add a Web Part" button.
  3. Select a Content Editor Web Part (CEWP).
  4. The new CEWP will appear at the top of the column so you need to grab it and drag it to the bottom of the column.
  5. Put the CEWP in edit mode by choosing "Modify Shared Web Part" from it's edit link.
  6. Now select the "Source Editor" button and enter this code into the window that opens:
    <a href="javascript:scroll(0,0)">
    &nbsp
    </a>

    The 0,0 parameters in this code is the x and y positions on the page (in pixels) so this tip can be modified to position the page at any place you want. 
  7. Close the code window by saving it.
  8. Finally set the following parameters of the CEWP
    • Under the +Appearance section set these
      • Title:  Jump to Top
      • Chrome State: Normal
      • Chrome Type: None
  9. Save the changes to the CEWP.

Last modified at 2/23/2008 7:20 AM  by LEEALLEN-SP1\lee.allen