I have an absolutely positioned div which acts as a modal window in the center of the page. The modal window is vertically scrollable with a scroll bar on the right hand side. The page itself is also vertically scrollable with a scroll bar on the right. I would like to be able to click on a link and have the modal window scroll to the linked item.
I can pretty much achieve this using target.scrollIntoView(); but the entire page scrolls along with the modal window - I would like it so the page does not move and have just the modal window scroll. If I use scrollIntoView(false) the page itself does not scroll, while the modal window does, but the target element is at the bottom of the window while I'd like it at the top.
Is there some way I can manually offset the position of the target within the div? i.e. if I use scrollIntoView(false), the target is displayed at the bottom of the div - if I could then offset it by the height of the view window I should be able to move it to the top..?
Note: I can't use JQuery or the like for this.
Thanks in advance for any help.