How to load a lazy loaded turbo frame a bit before it scrolls into view

A quick tip that you might find useful if you want to improve loading of a lazy loaded turbo frame.

If you would prefer if the user didn’t see the loading most of the time you can start loading it a bit before it scrolls into view so it’s already loaded when the user gets there: How to load a lazy loaded turbo frame a bit before it scrolls into view.

1 Like

Nice post @radanskoric!

I think it is possible for Turbo to support that natively.

An interface that accepts only the bottom margin for lazy loading would be enough, I think.

@pedro it would be enough for this case. But as soon as you deviated from this particular case it would be no help at all. So my hesitation in proposing to add it to Turbo is that it would be too narrow of a use case for a widely used library like Turbo. And since it’s not that hard to add just in the app code maybe it doesn’t make sense to start adding this to Turbo itself … I might be wrong, that’s just my current thinking on the topic.

1 Like