PDA

View Full Version : Sitcky Note Script - position!



dua_tao
03-12-2005, 03:15 AM
Sitcky NOte Script
http://www.dynamicdrive.com/dynamicindex17/stickynote.htm


this is a great script!

Just wondering if anyone can help... is there any way to position the Sticky NOTE other then in the centre of the page??

dua_tao

jscheuer1
03-12-2005, 05:01 AM
As far as I can see, there are three lines in the script that apply to the sticky's position. The first two appear together and establish the original spot:


objref.style.left=docwidth/2-objwidth/2+"px"
objref.style.top=scroll_top+docheight/2-objheight/2+"px"

the third is later in the script and makes it static at that position when the page is scrolled up and down:


objref.style.top=scroll_top+docheight/2-objheight/2+"px"

Apparently no attempt is made to fix the position left to right on browsers that will scroll the page left to right. None may be needed, I'm not going to go into that further here.

To change the initial and subsequent positioning, you only need to change the math in these three statements to reflect your desires. Say you want it to be 50 pixels to the right of center and 60 pixels above center. Here is how the first two statements could be altered (orange bold italics added to show changes):


objref.style.left=(docwidth/2-objwidth/2)-50+"px"
objref.style.top=(scroll_top+docheight/2-objheight/2)-60+"px"

I'm not sure the parenthesis are needed but, they will not hurt and make it clearer to the human eye. And similarly to the third statement:


objref.style.top=(scroll_top+docheight/2-objheight/2)-60+"px"

That should do it.

dua_tao
03-13-2005, 02:28 AM
Thanks! it worked like a gem :]