i havee one div element in my site with several anchors, that i link to.
to change from anchor to another id like to have a smooth scrolling effect.
all the smooth scrolling effects i could finde onlinee where to generall change all the links on the webpage and where quite overloaded. so i trieed to do something on my own. ther ist no error coming from firefox, but it doesent work also. maybe someonee can help me with this.
heres the function ive written:
Expand|Select|Wrap|Line Numbers
- function smoothScrolling(ScrollElement,AnchorElement)
- {
- var x = 5;
- var SE = document.getElementById(ScrollElement).scrollTop;
- var AE = document.getElementById(AnchorElement).offsetTop;
- if(SE > AE)
- for(i=SE;i<=(AE-8);i=i+1)
- {
- setTimeout("SE = i;",x);
- x = x+5;
- }
- else
- for(i=SE;i>=(AE-8);i=i-1)
- {
- setTimeout("SE = i;",x);
- x = x+5;
- }
- }
if anybody has a idea, what the problem about theis code, please let me know - that would be great.
all the best
trom