Use the element from the link, not the link itself

when calculating offset.