It is super ugly, but it was the only thing that worked consistently when I wrote the code. I had many bugs with it displaying in the wrong place and noticed it worked properly if you tried a few times in a row.
The logic is used in several places, notably in the scrolling post stream to determine what post you’re currently looking at. What worries me if we replace lock-on with a different algorithm, is our eyeline tracking broken now?
Replacing this could cause a lot of regressions, particularly when the header has been customized by CSS to be larger or to contain custom content.
I have a lot on my plate right now, so my vote would be to revert jQuery for now if that’s the cause and revisit when we have more time.