Lazy loading prevents links to anchors from working correctly

Today I learned what was lazy loading. It’s obviously nice in principle, but it’s causing me annoying problems.

Basically, I have a header towards the end of one of my pages, and some text at the top that links to it. Since I have a few images in that page, those don’t all load when the page itself loads, but only when I scroll down. This means that if I click on the link, instead of sending me to the end of the page, it sends me half-way for some reason. If I scroll down completely, the page fully loads, and if I try the link again it works fine.

I’ve been searching for almost two hours on how to fix this, and I’m not even sure if it’s the specific theme I’m using or Hugo itself that causes this behavior. I’ve been trying to comment out every single reference to functions that alter image loading in the partials, CSS and JS directories or altering files but either it does nothing, or prevents the images from loading altogether. There’s no option that I can see anywhere on how to disable lazy loading.

Any suggestion?