Offset calculation was wrong

When using a big offset the scrollspy detection failed on lower parts of
the page.