PDA

View Full Version : Changing 'jump to top' script so it sits left side of screen



k_mailbx
06-23-2008, 07:35 AM
Hi

Does anyone know how to change the 'jump to top' script so it sits on left side of screen not the right side?

http://www.dynamicdrive.com/dynamicindex5/jumptop.htm

Thanks

- K

jscheuer1
06-23-2008, 08:27 AM
Here in the script:


function inserttext(){ //function for IE4/ NS6
if (ie4)
crosslogo=document.all.logo
else if (ns6)
crosslogo=document.getElementById("logo")
crosslogo.innerHTML='<a href="'+logolink+'">'+displayed+'</a>'
w=ns6 || window.opera? window.innerWidth-crosslogo.offsetWidth-20 : ietruebody().clientWidth-crosslogo.offsetWidth-10
h=ns6 || window.opera? window.innerHeight-crosslogo.offsetHeight-15 : ietruebody().clientHeight-crosslogo.offsetHeight-10
crosslogo.style.left=w+"px"
crosslogo.style.top=h+"px"
if (ie4)
window.onscroll=staticit
else if (ns6)
startstatic=setInterval("staticit()",100)
}

Change the highlighted line to whatever value you like, ex:

w=25;

That would make the position 25 pixels from the left of the window. No calculation is required for positioning this on or near the left side of the window because the width of the window (what all that math is for) is irrelevant.

This value will also be used later in the script to calculate where to position the link should the window be scrolled horizontally, thus keeping it in view at the position you've designated.

k_mailbx
06-23-2008, 09:57 AM
Thank you - works a treat!

One further question - if I want the current blue link to be black how would I go about that? its picking up turning white when I hover over it - as per my settings for other links.

- K

jscheuer1
06-23-2008, 02:30 PM
The link is inside of a span with the id of 'logo'. So, you may specify some or all of these for it in your stylesheet:


#logo a:link {
color:black;
}
#logo a:visited {
color:black;
}
#logo a:hover {
color:black;
}
#logo a:active {
color:black;
}

You don't need to use the same color for all of them, that's up to you. Other style property/value pairs may be used. Not all pairs will have exactly the effect you might imagine, as the script requires certain things to function, so in some few cases, your choices will either be overridden by the script or mess up the script. You will generally know if and when either of those two things happen. But if you have a question about a particular style that isn't working out for you, let us know.