PDA

View Full Version : positioning in Scroll to Top Control



songworks
12-18-2009, 08:33 PM
1) Script Title: Scroll to Top Control Script

2) Script URL (on DD):

http://www.dynamicdrive.com/dynamicindex3/scrolltop.htm

3) Describe problem:

The script uses fixed positioning to place the link/image relative to the browser window. Is there a way to place it relative to a containing div? In my case, I wish to contain this link inside the layout border, so if user expands browser window horizontally the link won't go beyond the 'wrapper' div.

ddadmin
12-18-2009, 10:29 PM
The script does let you create any arbitrary image link on the page and have it scroll the page to the top when clicked on, for example:


<a href="#top"><img src="up.gif" /></a>

Does that help, or do you also need this custom image to behave just like the fixed position image which fades/ hide as the page is scrolled?

songworks
12-20-2009, 11:08 PM
My issue isn't about using a custom image....I get how to do that. I'm talking about how the script places the link, be it HTML or image, relative to the browser window. As a result, when this link becomes visible the user can easily cause the link to move outside of the wrapper DIV if he/she widens the browser window horizontally to a large degree. I want this link to be contained INSIDE of the wrapper DIV no matter how wide the user's browser window is.

Again, the default state of the script places the link based on the browser window. So if I set the variables as such:


controlattrs: {offsetx:150, offsety:145}

These coordinates are relative to the right/bottom of the browser window corner. I'd like them to be relative to the right/bottom of a DIV, ex: a wrapper div that is centered in the browser window, so the link is contained within that div.

I hope that makes more sense.:D