Howdy,
I know how to tell a DIV with a vertical scroll bar how far to scroll:
document.getEle mentById( 'myDIV' ).scrollTop += 40;
However, under certain conditions, 'myDIV' is hidden. Upon once again being
visible, I need to return (scroll) to the same position where the user was
before 'myDIV' was hidden. However, I can't figure out how to store the current
position for later retrieval. I've tried using the following:
thePosition = document.getEle mentById( 'myDIV' ).scrollTop;
But, scrollTop always seems to want to store this value instead:
thePosition = document.body.s crollTop;
Since the main window doesn't have a scroll bar on my screen, scrollTop always
has a value of 0. How do I find the scrolled position of the 'myDIV' instead of
the scrolled position of the body? Since I can set that value, I'm wondering
why I can't retrieve it.
Thanks!
Jim
I know how to tell a DIV with a vertical scroll bar how far to scroll:
document.getEle mentById( 'myDIV' ).scrollTop += 40;
However, under certain conditions, 'myDIV' is hidden. Upon once again being
visible, I need to return (scroll) to the same position where the user was
before 'myDIV' was hidden. However, I can't figure out how to store the current
position for later retrieval. I've tried using the following:
thePosition = document.getEle mentById( 'myDIV' ).scrollTop;
But, scrollTop always seems to want to store this value instead:
thePosition = document.body.s crollTop;
Since the main window doesn't have a scroll bar on my screen, scrollTop always
has a value of 0. How do I find the scrolled position of the 'myDIV' instead of
the scrolled position of the body? Since I can set that value, I'm wondering
why I can't retrieve it.
Thanks!
Jim
Comment