jQuery scroll to top

You can customize a variety of things, such as the amount of time it takes the script to scroll back up to the top, duration of the fade in/out effect for the control, and the number of pixels the user's scrollbar should be from the top of the page before revealing the control. Inside the .js file, here is the relevant section to modify:

setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
controlHTML: '<img src="up.png" style="width:24px; height:24px" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
controlattrs: {offsetx:15, offsety:15}, //offset of control relative to right/ bottom of window corner
anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links

For "controlHTML", you can enter any HTML you wish to be shown as the control, though it should be something simple, such as an , or even just plain text. The setting "anchorkeyword" lets you enter the href value of HTML anchors on the page (if any) that should be parsed by the script and assigned the "scroll to top" behaviour to. With the above setting, the following HTML anchor on the page would also scroll the page back up to the top:

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

Source: dynamicDrive

AttachmentSize
scrolltopcontrol.js3.74 KB
up.png1.86 KB