I dont know i may have missed it but does someone have a link that demonstrates this script. If you do please write to me at juliomanson@aol.com and write “internal links scroller” in the subject line so that your mail isnt mistaken for spam. Thank you very much. I am looking forward to seeing your responses.
To make this script works with any destination element with an id attribute… not necessarely an anchor… just replace
var allLinks = document.getElementsByTagName(‘a’);
var destinationLink = null;
for (var i=0;i<allLinks.length;i++) {
var lnk = allLinks[i];
if (lnk.name && (lnk.name == anchor)) {
destinationLink = lnk;
break;
}
for:
destinationLink = getObjById(anchor);
and getObjById is a x-browser function for referring to an object:
function getObjById(name)
{
if (document.getElementById)
{
this.obj = document.getElementById(name);
}
else if (document.all)
{
this.obj = document.all[name];
}
else if (document.layers)
{
this.obj = document.layers[name];
}
return this.obj;
}
This doesn’t work in Safari 1.3. When you click a link, it scrolls all the way to the bottom then reloads the page and then lands at the intended anchor. Same thing happens in OmniWeb 4.5 and 5.1 but without the scrolling.
How could I make a link in the document loaded into the iframe, that would scroll the window to the right (some sort of a “next” link). I triend using top.location.href, but it doesn’t work…
Great article… The code is way over my head by the effect is what I’m looking for and it works great on Opera and Firefox.
One thing, is there anyway to slow the scroll as the window approaches the div? Rather than scrolling at a constant speed, I’d like the effect to behave more like the movement of a train ‘pulling in’ and ‘out’ of a station. Is that possible?