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:
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:
Source: dynamicDrive
| Attachment | Size |
|---|---|
| scrolltopcontrol.js | 3.74 KB |
| up.png | 1.86 KB |
- Categories:
- heihachi's blog
- Add new comment
- 1548 reads

Recent comments
5 hours 21 min ago
8 hours 13 min ago
1 day 10 hours ago
1 day 16 hours ago
4 days 2 hours ago
4 days 2 hours ago
2 weeks 1 day ago
3 weeks 7 hours ago
4 weeks 2 days ago
7 weeks 5 days ago