DelphiFAQ Home Search:

How to make a link reposition when the user scrolls


comments1 comments. Current rating: 1 stars (1 votes). Leave comments and/ or rate it.


I need to have a 'floating link' - it shall always appear at the same position no matter how far down the user scrolls.


You need to use a cascading stylesheet to define a positionable page element and then set an onscroll() event handler to reposition this page element.
In Netscape and Opera there is no such onscroll event. Instead you could use setInterval and reposition every couple of seconds.
Place your link in this positionable page element.


2011-12-02, 07:55:32   (updated: 2011-12-02, 07:55:57)
anonymous from Belarus  
use style='position:fixed' and define position with ('left' or 'right') and ('top' or 'bottom'), e.g. style='position:fixed;left:10px;top:100px'
This does not work in old IE, but there are hacks (google for it).



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: