Forum Moderators: open
I have this page with a Ilayer which display the content trough clicking in different anchor names (blue menu). So far couldn't find the right script to add to the onclick event so that the page won't scroll up when an anchor name is clicked.
i know this is basic for most of you guys so any help is really appreciated.
Thanks
aidem
[edited by: encyclo at 1:38 am (utc) on April 1, 2007]
[edit reason] no URLs please, see TOS [webmasterworld.com] [/edit]
Add this javascript to the top of your document:
var s3;
function sTo(a) {
if (!a) return true;
if (!s3) s3=document.getElementById('scroll3')
var e=document.getElementById(a.hash.substring(1))
if (e && s3) {s3.scrollTop=e.offsetTop;return false;}
}
and this attribute to each link:
onclick="return sTo(this)"
example:
<a href="#zippy" onclick="return sTo(this)">