Hello all,
I have a problem with a scrript in safari 3. in mozilla/firefox and opera the problem does not exist.
what i try to do: I have a div element with overflow:auto. in the element i have several anchors, wich i can scroll to with several anchor links. this works quite nicely.
the div content can be scrolled by a JS-scrolling script. when i click on a anchor link the scrolling script loses its position, so the next time i will scroll, it will scroll from where i was before i was clicking the anchor link. to prevent this ive set a global variable, that saves the actual position of the scrolled text. the crolling script is then using this variable to scroll from the actual position.
this is all working fine except in safari 3 (mac).
the problem seems to be that safari somehow does not like to handel the gloabl variable or the offsetTop values.
to demonstrate what i mean ill post an example here:
has anybody a idea how to do this in safari? iam kind of stuck. offsetTop is available for safari and global JS variables uasually also. so i dont see the problem.
would appreciate a hint in the right direction :-)
if something is not clear, please let me know.
thanks
tobias
I have a problem with a scrript in safari 3. in mozilla/firefox and opera the problem does not exist.
what i try to do: I have a div element with overflow:auto. in the element i have several anchors, wich i can scroll to with several anchor links. this works quite nicely.
the div content can be scrolled by a JS-scrolling script. when i click on a anchor link the scrolling script loses its position, so the next time i will scroll, it will scroll from where i was before i was clicking the anchor link. to prevent this ive set a global variable, that saves the actual position of the scrolled text. the crolling script is then using this variable to scroll from the actual position.
this is all working fine except in safari 3 (mac).
the problem seems to be that safari somehow does not like to handel the gloabl variable or the offsetTop values.
to demonstrate what i mean ill post an example here:
Code:
<script type="text/javascript">
var scrollCursorGlobal = 1;
</script>
<a href="test.php#3" onclick="scrollCursorGlobal=(document.getElementById('3').offsetTop-8);alert((document.getElementById('3').offsetTop-8));">test</a>
<div id="testdiv" style="height:100px; float:left; overflow: auto; width:140;">
<br>
test1
<br>
text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text
<a name="2" id="2"></a>
<br>
test2
<br>
text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text
<a name="3" id="3"></a>
<br>
test3
<br>
text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text
</div>
would appreciate a hint in the right direction :-)
if something is not clear, please let me know.
thanks
tobias
Comment