Dynamic Button to Scroll to Page Top: Add a link dynamically to scroll to the page top

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 262 All time: 175 This week: 4Up
Version License JavaScript version Categories
button-scroll-top 1.0BSD License3.0HTML
Description Author

This object can add a link dynamically to scroll to the page top.

It can check if the page height is smaller than the page length and if so dynamically adds a link to the page that will scroll it to the top when the user clicks on the link.

The object can remove the link if the scroll position is already at the top of the page.

Innovation Award
JavaScript Programming Innovation award nominee
January 2013
Number 4
Using a link to let the user scroll the page to the top is simple.

However, if the page does not have much content and can fit in the current browser window height, adding a link to scroll to the top is not necessary because the browser is already at the top of the page.

This JavaScript object can add a link to scroll to the top of the page only if the page height exceeds the height of the visible part of the page.

Manuel Lemos
Picture of MarPlo
  Performance   Level  
Name: MarPlo <contact>
Classes: 13 packages by
Country: Romania Romania
Age: ???
All time rank: 131 in Romania Romania
Week rank: 6 Up1 in Romania Romania Equal
Innovation award
Innovation award
Nominee: 5x

Winner: 1x

  Files folder image Files  
File Role Description
Files folder imagescrtop (3 files)
Accessible without login Plain text file scrolltop.html Example Test pae

  Files folder image Files  /  scrtop  
File Role Description
  Accessible without login HTML file index.html Data Index file in scrtop directory
  Accessible without login Plain text file scrolltop.css Data CSS code
  Plain text file scrolltop.js Class JavaScript code

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:175
This week:4Up