Calculate scroll offset relative to the position of the table in the document